C#——调用exe程序并运行

来源:互联网 发布:淘宝卖家怎么做直播 编辑:程序博客网 时间:2024/05/21 19:50


来自:http://topic.csdn.net/u/20080724/12/7755ba16-a7dc-4ea3-89ea-1c4b7b35b865.html

 

命名空间:using System.Diagnostics; 

 

1、设置exe程序运行的窗体的样式 “最大化”、“最小化”、“标准”

ProcessStartInfo startInfo = newProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;

Process.Start(startInfo);

 

2、设置exe程序运行的运行参数

startInfo.Arguments = "www.northwindtraders.com";

Process.Start(startInfo);

 

3、如果调用DOS程序

来自:http://zhidao.baidu.com/question/57228449

如果是dos
Process.Start("cmd.exe");
如果是其他文件
Process.Start("绝对路径+文件名.exe");
------------------------------------
如何在c#中调用外部dos程序?
使用Process对象:
System.Diagnostics.Process p=new System.Diagnostics.Process();
p.StartInfo.FileName="arj.exe" ;//需要启动的程序名
p.StartInfo.Arguments="-x sourceFile.Arj c:\temp";//启动参数
p.Start();//启动
if(p.HasExisted)//判断是否运行结束
p.kill();

0 0
原创粉丝点击