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 arguments property set. Is there a way to mimic a true shell-like execute (like the one when you press WIN+R)?
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";
ProcessStartInfo.UseShellExecute使Process.Start的行为与Shell完全相同: http : //msdn.microsoft.com/zh-cn/library/system.diagnostics.processstartinfo.useshellexecute.aspx
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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.