我现在要执行一个bat文件,里面的内容是:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil .\IMQService.exe请问我的C#里面执行要怎么做?我现在的方法是:
System.Diagnostics.Process.Start("cmd.exe", @"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil " +".\IMQService.exe");请问有什么错误,还有什么好的方法,请高手指教,谢谢。。
System.Diagnostics.Process.Start("cmd.exe", @"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil " +".\IMQService.exe");请问有什么错误,还有什么好的方法,请高手指教,谢谢。。
解决方案 »
- WPF中TreeView控件双击不展开/折叠节点等方法
- 分享读取各大主流邮箱通讯录(联系人)、MSN好友列表的的功能[2.0版]预告贴
- [C#]简单的问题,关于ArrayList
- 如何筛选编码在一定范围内的汉字
- 请问Server.UrlEncode是属于哪个命名空间?
- 急,不好意思,一个小问题谢谢
- 远程创建数据库??大伙救命啊~~~~~~~~~~~~~急~~~~~~~~~~急~~~~~~~(实现就给分)
- 在线程中打开窗体,窗体打开后立即关闭,为什么?
- 难题!!!!:javaScript 能不能使用TreeView的节点?
- 为什么我的程序取不到C盘的WINNT还有,Program Files这些系统目录???看看我的代码错了吗???
- VisualStudio的Code Coverage是怎么编译出与标准的编译出的代码不一样的?
- 求助 C#中如何使程序存储上一次选择的打印机(分数:100+)
myprocess.StartInfo.FileName = "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil .\IMQService.exe";
myprocess.StartInfo.Verb = "Open";
myprocess.StartInfo.CreateNoWindow = true;
myprocess.Start();以前写过的类似调用 看看能用不
试试看!
System.Diagnostics.Process.Start(@"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil " +".\IMQService.exe");或者捕捉CMD的输入输出流:
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput =true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.StandardInput.WriteLine("xxx.bat");
p.StandardInput.WriteLine("exit");
p.StandardOutput.ReadToEnd();
p.Close();
System.Diagnostics.Process.Start("C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil。exe","<这个地方填完整路径>IMQService.exe")
但是这个IMQService.exe应该是你自己的一个service吧。
把第二参数,填入IMQService.exe的完整路径。
System.Diagnostics.Process.Start("C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 \installutil.exe"," <完整路径>IMQService.exe")