代码改变世界

在.net平台下,执行命令行

2007-05-14 14:03  ruinet  阅读(404)  评论(0编辑  收藏  举报
 //---格式一
      System.Diagnostics.Process.Start("CMD.exe""/c net send 10.116.193.89 你好!");
     
// System.Diagnostics.Process.Start("cmd.exe","/c ipconfig");

      
//---格式二
      Process MyProcess = new Process();
      MyProcess.StartInfo.FileName 
= "CMD.exe";
      MyProcess .StartInfo.CreateNoWindow 
=true ;
      MyProcess.StartInfo.Arguments 
= "/c ipconfig";
      MyProcess.StartInfo.WindowStyle 
= ProcessWindowStyle.Hidden;//使窗体不显示出来
      MyProcess.Start();

      
//----格式三
      System.Diagnostics.Process.Start("IExplore.exe""D:");
      System.Diagnostics.Process.Start(
"IExplore.exe""www.baidu.com");

free web counter