码迷,mamicode.com
首页 > Windows程序 > 详细

[C#]在程序中启动另外一个程序

时间:2015-05-26 06:54:35      阅读:238      评论:0      收藏:0      [点我收藏+]

标签:desktop   程序   users   空间   命名   

C#实现在程序中启动另外一个程序

ProcessStartInfo info = new ProcessStartInfo();   
info.FileName = "notepad++.exe";//要启动的程序外部名称  
info.Arguments = "1009.txt";//设置外部程序的启动参数   
info.WorkingDirectory = @"D:\Users\Desktop";   
Process pro;//申明一个程序类  
try  
{   
    pro = Process.Start(info);   
}   
catch(System.ComponentModel.WarningException e) 
  
{   
    Console.WriteLine("系統找不到指定的程序文件"+e.Message);   
}

注意:需要添加以下命名空间

using System.Diagnostics;


本文出自 “花开花落” 博客,谢绝转载!

[C#]在程序中启动另外一个程序

标签:desktop   程序   users   空间   命名   

原文地址:http://020618.blog.51cto.com/6098149/1655085

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!