C# 调用exe 并传参
来源:互联网 发布:c语言exit(0) 编辑:程序博客网 时间:2024/06/05 20:42
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo = new System.Diagnostics.ProcessStartInfo();
p.StartInfo.FileName = FilePath;
Console.WriteLine("Input the command, Please");
string strArgs = Console.ReadLine();
p.StartInfo.Arguments = strArgs;//空格分隔各个参数 这里有两个参数。
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;//让窗体不显示
p.Start();
System.IO.StreamReader reader = p.StandardOutput;//截取输出流 ,如果exe中有Console.WriteLine("..")
string outLine = reader.ReadLine();//每次读取一行
另外一种是调用dos,并执行命令
string strIp = ConfigurationSettings.AppSettings["IP"].ToString();
string strPath = ConfigurationSettings.AppSettings["Path"].ToString();
string strAllData = ConfigurationSettings.AppSettings["AllData"].ToString();
string strArgs = string.Empty;
string strCmd = Console.ReadLine();
if (strCmd == "show")
{
Console.WriteLine(strAllData);
}
else
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.UseShellExecute = false;
p.Start();
p.StandardInput.WriteLine("rsh " + strIp + " " + strPath + " " + strCmd);
p.Close();
}
- C# 调用exe 并传参
- java调用外部exe程序并传参
- java调用外部exe程序并传参
- java调用外部exe程序并传参
- C# 调用exe 传参 ,并获取打印值
- c#调用EXE程序
- C#调用Exe
- C#调用Exe
- c# 调用 pdf2swf.exe
- C#调用exe程序
- c#调用EXE程序
- C#调用exe源代码
- C#调用外部exe
- c#调用外部exe程序
- c#调用外部exe程序
- C#调用EXE 传参 收藏
- C#中调用exe程序
- C#调用exe文件源代码
- c99中的restrict(转)
- C#中Abstract和Virtual
- linux编程的108种奇淫巧计-16(如何达到内存最大带宽,复杂指令)
- Android连接远程数据库
- 方正web开发平台之Web安全
- C# 调用exe 并传参
- sfc /scannow 提示 插入Windows XP SP3 CD 光盘
- VS2005 MINI6410 PWM 测试程序
- Oracle中rowid和rownum区别
- 一天一个单词--持续更新
- java面试中关于学员一些sql语句的写法
- 事件和方法有什么区别?
- 开发平台的两种实现模式
- MVC-数据验证