Executing DOS commands from with my application

G

Guest

Hi I want my VB.NET application to run a command from the command line and then wait for the command to finish before continuing.

I am currently using

System.Diagnostics.Process.Start(strApp)

where strApp is the the command line text.

However this method starts a new process and therefore my application continues without waiting.

Any ideas?
 
J

Jon Skeet [C# MVP]

hplloyd said:
Hi I want my VB.NET application to run a command from the command
line and then wait for the command to finish before continuing.

I am currently using

System.Diagnostics.Process.Start(strApp)

where strApp is the the command line text.

However this method starts a new process and therefore my application
continues without waiting.

Any ideas?

Process.Start returns a Process reference. Use Process.WaitForExit to
wait for that process to complete.
 
G

Guest

You can use Process.WaitForExit, supplying an interval in milliseconds if you are concerned the process could hang.

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top