运行EXE与参数 [英] Running EXE with parameters
问题描述
我需要想从我的C#应用程序执行可执行文件的帮助。结果
假设路径为 CPATH
,EXE文件是 HHTCtrlp.exe
并具有传递的参数是 cParams
。
I need help in trying to execute an executable from my C# application.
Suppose the path is cPath
, the EXE is HHTCtrlp.exe
and the parameter that has to be passed is cParams
.
我怎么会去吗?
之所以路径是可变的是,有3个不同的EXE文件以运行和路径将取决于哪一个运行的变化,相同的参数串。
The reason why the path is a variable is that there are 3 different EXE files to run and the path will change depending on which one will run, same with the parameter string.
任何帮助将大大AP preciated。
Any help would be greatly appreciated.
推荐答案
要开始使用参数的过程中,您可以使用下面code:
To start the process with parameters, you can use following code:
string filename = Path.Combine(cPath,"HHTCtrlp.exe");
var proc = System.Diagnostics.Process.Start(filename, cParams);
要杀死/再退出程序,您可以使用下面code:
To kill/exit the program again, you can use following code:
proc.CloseMainWindow();
proc.Close();
这篇关于运行EXE与参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!