Start a command line including arguments from C#

后端 未结 3 1205
不知归路
不知归路 2021-01-15 11:33

I need to start a complete command line like \"app.exe /arg1:1 /arg2:true\" from my C# app.

Process.Start and ProcessStartInfo needs to have the filename and argumen

相关标签:
3条回答
  • 2021-01-15 11:51

    Yes, you can launch cmd.exe with the full command-line you want to send as the arguments.

    info.FileName = "cmd.exe";
    info.Arguments = "app.exe /arg1:1 /arg2:true";
    
    0 讨论(0)
  • 2021-01-15 12:04

    ProcessStartInfo.UseShellExecute makes Process.Start behave exactly like the Shell: http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.useshellexecute.aspx

    0 讨论(0)
  • 2021-01-15 12:10

    I've found the solution I've been looking for: Executing another program from C#, do I need to parse the "command line" from registry myself?

    Thanks again for your help!

    0 讨论(0)
提交回复
热议问题