如何在.net应用程序中执行其他程序?

1.
 Process p = new Process();
 p.StartInfo.FileName 
= "cmd.exe";
 p.StartInfo.Arguments 
= "/c"+ "notepad.exe";
 
//p.StartInfo.Arguments = "/c"+"C:\\\"Documents and Settings\"\\Test\\Test.exe";
 p.StartInfo.UseShellExecute = false;
 p.StartInfo.CreateNoWindow 
= false;
 p.Start();
 
if (waitForExit)
      p.WaitForExit();

2.
WinExec
[DllImport("kernel32.dll")]
    public static extern int WinExec(string exeName, int operType);
    
public void StartProgram()
{
      WinExec("....name.exe",5);
}

3.
用ShellExecute
posted @ 2007-07-31 11:34  peak  阅读(235)  评论(0)    收藏  举报