How to execute the console command without running cmd ?

  • one
    which one? and why it is important not to run cmd.exe? - 4per
  • for example work with php console - Dmitriy Gvozd
  • you must run cmd.exe to execute the command, but make the window itself hidden - Ruslan_K
  • Running the process without cmd.exe, as an option. - Vladimir Martyanov
  • in order to execute CLI PHP commands under Windows, you can run php.exe with parameters, right? Or run once and then pass only the parameters, or so it will not work? - Dmitry Nail

1 answer 1

Example with hidden cmd.exe

 string cmd = "calc.exe"; var proc = new ProcessStartInfo() { UseShellExecute = true, WorkingDirectory = @"C:\Windows\System32", FileName = @"C:\Windows\System32\cmd.exe", Arguments = "/c " + cmd, WindowStyle = ProcessWindowStyle.Hidden }; Process.Start(proc);