Execute command

  • Thread starter Thread starter George Varelas
  • Start date Start date
G

George Varelas

Hi,
can anyone tell me how can I execute an external command such as dos command
through my windows application which is built in C#.

VB has the "Shell(...)" function but I couldn't find something like this in
C#.

Thanks
George
 
Hello,

you can use the Process.Start() method to to this.

Best regards,
Henning Krause
 
Henning:
Is Process.Start() equivalent to ShellEcecute() or rather CreateProcess()
 
Hello,

it depends... :-)

You can pass a ProcessStartInfo to the method. And this class has a
property UseShellExecute. If set to true, it will use ShellExecute,
otherwise it will do a CreateProcess.

But if you specify a username and password (.NET 2.0 only), it will run the
process under those specified credentials with the CreateProcess behavior.
ShellExecute=true is not possible in this scenario.

Best regards,
Henning Krause
 
Back
Top