1

I am running a batch file with shell function in VB2010 with the following command

Shell("C:\test.bat", AppWinStyle.NormalFocus)

This process takes a lot of time to complete, might even take a day to complete depending on the input file.

I want a MsgBox to display a "Job Finished" msg when the process is finished. something like

MsgBox("Job Finished")

How do I do that. I am very new to VB, so please help me with full code. Thank you

mamon
  • 27
  • 5

1 Answers1

1

This will basically wait till the process finishes (It finishes by exiting. as most batch files do. I'm only making an assumption though).

 Sub Main()
            Dim P As New Process
            P.StartInfo.FileName = "C:\test.bat"
            Try
                P.Start()
                P.WaitForExit()
                MsgBox("Process completed successfully")
            Catch ex As Exception
                MsgBox("Error:" & ex.Message)
            End Try
        End Sub
Amen Jlili
  • 1,884
  • 4
  • 28
  • 51
  • I have already done this and this is working just as desired, but thank you anyway for your suggestion. – mamon Feb 13 '15 at 15:12