惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
J
Java Code Geeks
有赞技术团队
有赞技术团队
GbyAI
GbyAI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
Microsoft Security Blog
Microsoft Security Blog
IT之家
IT之家
G
Google Developers Blog
月光博客
月光博客
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
腾讯CDC
V
Visual Studio Blog
博客园 - 【当耐特】
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Engineering at Meta
Engineering at Meta
L
LangChain Blog

博客园 - J-Pei

entity framework ConnectionString include password Microsoft Visual Studio无法启动程序进行调试的解决方法 深入理解Javascript闭包(closure) 安装SQL Server 2005过程出现错误:“SQL Server 服务无法启动”的解决办法 动态修改div的xy值 asp.net mvc 与jquery应用总结 Ajax 选项 这才是真正的JQuery.ajax传递中文参数的解决方法 ASP.NET MVC生命周期介绍(转) ASP.NET页生命周期介绍:阶段,事件及其他(转) JQuery 实现网页的快捷键操作 IE8下json.js 中文编码问题 Meet Chirpy sybase性能调优 Entity FrameWork 4.1 RC 生成的sql语法性能存在问题 ADO.NET Entity FrameWork 4.1 RC 发布 asp.net MVC EF dynamic query 服务器返回json SQL SERVER 2008 MASTER数据库损坏修复
通过Process调用桌面程序
J-Pei · 2012-02-02 · via 博客园 - J-Pei

通过Process调用桌面程序

View Code

 1 private void Form1_Load(object sender, EventArgs e)
 2         {
 3             string userid = "admin";
 4             string password = "00";
 5             string[] cmd = new string[] { @"cd E:\Project\DotNet\bin\Debug""PhotoMan.exe $StartFromEIP$ " + userid + " " + assword };
 6 
 7             Process p = new Process();
 8             p.StartInfo.FileName = "cmd.exe";
 9             p.StartInfo.UseShellExecute = false;
10             p.StartInfo.RedirectStandardInput = true;
11             p.StartInfo.RedirectStandardOutput = true;
12             p.StartInfo.RedirectStandardError = true;
13             p.StartInfo.CreateNoWindow = true;
14             p.Start();
15             p.StandardInput.AutoFlush = true;
16             for (int i = 0; i < cmd.Length; i++)
17             {
18                 p.StandardInput.WriteLine(cmd[i].ToString());
19             }
20             p.StandardInput.WriteLine("exit");
21             string strRst = p.StandardOutput.ReadToEnd();
22             p.WaitForExit();
23             p.Close();
24             Form1_FormClosed(nullnull);
25 
26         }
27 
28         private void Form1_FormClosed(object sender, FormClosedEventArgs e)
29         {
30             Application.Exit();
31         }