I have the following code which works under Linux :
ProcessStartInfo startInfo = new ProcessStartInfo();
// Set in the process the executable and arguments
startInfo.FileName = "ps";
startInfo.Arguments = "a";
Process proc = Process.Start(startInfo);
proc.WaitForExit();
return proc.ExitCode;
However when I try using the process under Windows for a simple commands :
ProcessStartInfo startInfo = new ProcessStartInfo();
// Set in the process the executable and arguments
startInfo.FileName = "call";
startInfo.Arguments = "gpedit.msc";
Process proc = Process.Start(startInfo);
proc.WaitForExit();
return proc.ExitCode;
It doesn't work (I know running thins command in cmd.exe works fine).
I get : Win32Exception was unhandled
.
I also read this tutorial over again : How do I start a process from C#?
I used process a lot under Linux but I cannot see what I do wrong in Windows.