2024年1月22日发(作者:)
在c#中调用另一个应用程序或命令行(.exe 带参数)
在.net中使用s可以用来调用另一个命令行或程序。
using stics;
如果是dos
("");
如果是其他文件
("绝对路径+文件名.exe");
------------------------------------
如何在c#中调用外部dos程序?
使用Process对象:
s p=new s();
me="" ;//需要启动的程序名
nts="-x c:temp";//启动参数
();//启动
if(sted)//判断是否运行结束
();
---------------------------------------------------------------------------------------- ------
///
/// 启动其他的应用程序
///
/// 应用程序名称
/// 应用程序工作目录
/// 命令行参数
/// 窗口风格
public static bool StartProcess(string file,string workdirectory,string
args,ProcessWindowStyle style)
{
try
{
Process myprocess = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo(file,args);
Style = style;
gDirectory = workdirectory;
nfo = startInfo;
llExecute = false;
();
return true;
}
catch(Exception e0)
{
("启动应用程序时出错!原因:" + e);
}
return false;
}
string parms = "" + tance().UserID + " " +
tance().UserPassword;
if (rocess(pPath +
@"",pPath + "UpTool",parms,))
{
(0);
} ---------------------------------------------------------------------------- ----------------


发布评论