Advertisement

C#调用外部.exe的方法分为简单和复杂两类

阅读量:

最为基础的方式便是直接采用process类进行操作

复制代码
    using System.Diagnostics;
    Process.Start(" demo.exe");
    
    
      
      
    

如需进行详尽的配置操作,则

复制代码
    		public static void RunExeByProcess(string exePath, string argument)
    		{
    			//创建进程
    			System.Diagnostics.Process process = new System.Diagnostics.Process();
    			//调用的exe的名称
    			process.StartInfo.FileName = exePath;
    			//传递进exe的参数
    			process.StartInfo.Arguments = argument;
    			process.StartInfo.UseShellExecute = false;
    			//不显示exe的界面
    			process.StartInfo.CreateNoWindow = true;
    			process.StartInfo.Redirect

全部评论 (0)

还没有任何评论哟~