如何使用C#在命令提示符中执行程序文件中的exe [英] How do I execute an exe in program files in command promptr using C#
本文介绍了如何使用C#在命令提示符中执行程序文件中的exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用C#在命令提示符中执行程序文件中的exe?
笔架是第三方工具,我想用C#运行我的应用程序?
我尝试过:
How do i execute an exe in program files in command prompt using C#?
Pen mount is a third party tool and i would like to run through my application using C#?
What I have tried:
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
startInfo.FileName = "cmd.exe";
startInfo.WorkingDirectory = "C:\\program files\\PenMount Windows Universal Driver\\";
startInfo.UseShellExecute = false;
startInfo.Arguments = "/c " + "DMCCTRIL -Calibration 4";
process.StartInfo = startInfo;
process.Start();
推荐答案
试试这个:
Try this:
Process myProcess = new Process();
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.WorkingDirectory = @"C:\program files\PenMount Windows Universal Driver";
myProcess.StartInfo.FileName = "DMCCTRIL.exe";
myProcess.StartInfo.Arguments = @"/c -Calibration 4";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
如果这不起作用,那么你可以尝试 cmd.exe start ,参见:开始 [ ^ ]
这篇关于如何使用C#在命令提示符中执行程序文件中的exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文