including arguments with System.Diagnostics.Process.Start.... [resolved]
I can do
VB Code:
System.Diagnostics.Process.Start("C:\windows\system32\shutdown.exe")
but this returns a file not found error
VB Code:
System.Diagnostics.Process.Start("C:\windows\system32\shutdown.exe -r")
How do I include the switches at the end of the file name when using Process.Start?
thanks
kevin
Re: including arguments with System.Diagnostics.Process.Start command line exe
Create a process object, then fill in the ProcessInfo data and start it that way. I don't have the compiler here but you need something like this:
VB Code:
Dim pShutdown as Process
pShutdown.ProcessInfo.??? '<<< Don't know what it's called, but it's in there somewhere
pShutdown.Start
Re: including arguments with System.Diagnostics.Process.Start command line exe
thanks
here's what I got:
VB Code:
Dim p As New Process
p.StartInfo.FileName = "C:\windows\system32\shutdown.exe -r"
p.Start()
but I get the same result:
Quote:
The system cannot find the file specified
anyone/anything else?????
kevin
Re: including arguments with System.Diagnostics.Process.Start command line exe
There should be another member of "StartInfo" that controls the command line arguments called "Arguments" or something similar. You need to add:
VB Code:
p.StartInfo.Arguments = "-r"
to the code above, and remove the argument from the filename property. It should look like this:
VB Code:
Dim p As Process
p.StartInfo.Filename = "C:\windows\system32\shutdown.exe"
p.StartInfo.Arguments = "-r"
p.Start
Re: including arguments with System.Diagnostics.Process.Start command line exe
that's the ticket. thanks
kevin