Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute EXE 1

Status
Not open for further replies.

NTesla1886

Technical User
Mar 14, 2008
62
US
I am writing a VB 2008 Console Application that I need to have execute another exe application.

What is the easiest way to do this?
 
System.Diagnostics.Process.Start("C:\SomeFolder\SomeProgram.exe")
 
Thanks RiverGuy

The problem I have now is that if I attempt to run a program as if at a command prompt with options it says "Cannot find the specified file"

For example if I attempt to run"

chkdsk /p

I get an error that the specified file cannot be found



Kevin
Tektility Inc
Maximizing Potential Through Technology
 
After you type the string for your executable, trying typing a comma and look at the IDE tooltip. You pass in another parameter to the function to specify arguments.
 
One more question.

Is their a way for my app not to continue to the next line until the launched application has completed

Kevin
Tektility Inc
Maximizing Potential Through Technology
 
Here's an example:

Code:
        Dim proc As System.Diagnostics.Process = System.Diagnostics.Process.Start("Notepad.exe")
        proc.WaitForExit()
        MessageBox.Show("I'm not showing up until you close NotePad.")
 
I was not able to get what you had posted to work however once I changed it to:

Code:
Dim ProgramProcess As Process
ProgramProcess = Process.Start("Notepad.exe")

ProgramProcess.WaitForExit()

Thank you for all your help

Kevin
Tektility Inc
Maximizing Potential Through Technology
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top