[英]run command promt application from code C#
This is my code: 这是我的代码:
var startupPath = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName; // +\\Common
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments ="/c " + startupPath + @"\Common\sound 1.wav result.wav -tempo=35";
process.StartInfo = startInfo;
process.Start();
Pathes are correct. 路径正确。 A wanna to start application and set this parameters sound 1.wav result.wav -tempo=35
. 想启动应用程序并设置此参数sound 1.wav result.wav -tempo=35
。 What am I doing wrong? 我究竟做错了什么? content of startInfo.Arguments: startInfo.Arguments的内容:
"/c C:\\SOUNDS\\New folder\\TrunscribeHelper\\Common\\sound 1.wav result.wav -tempo=35"
I've tryed to start it directly: 我尝试直接启动它:
ProcessStartInfo startInfo = new ProcessStartInfo(string.Concat(startupPath + @"\Common", "\\", "sound.exe"));
startInfo.Arguments = "1.wav result.wav -tempo=35";
startInfo.UseShellExecute = false;
System.Diagnostics.Process.Start(startInfo);
But Am I doing wrong now? 但是我现在做错了吗?
Can you try changing this line: 您可以尝试更改此行:
startInfo.Arguments ="/c " + startupPath + @"\Common\sound 1.wav result.wav -tempo=35";
to 至
startInfo.Arguments ="/c \"" + startupPath + @"\Common\sound"" 1.wav result.wav -tempo=35";
您必须在args中的双引号下设置路径:
"/c \"C:\\SOUNDS\\New folder\\TrunscribeHelper\\Common\\sound 1.wav\" result.wav -tempo=35"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.