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

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-1 18:12   11   0


来自: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 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP