C#调用外部程序,传递参数

   public void z7(string cmdstr)
        {
           System.Diagnostics.Process p = new System.Diagnostics.Process();
            p.StartInfo.CreateNoWindow = true;
            p.StartInfo.FileName = "7za.exe";//需要启动的程序名     
             //p.StartInfo.Arguments = @"a  -t7z     d:\SMMM_2011103111620.7z  d:\SMMM_2011103111620.bak  -mx=9   ";//启动参数
            p.StartInfo.Arguments = @"a  -t7z    " + cmdstr + " -mx=9   ";//启动参数 
            p.Start();//启动   
        }

posted @ 2011-10-03 15:24  qanholas  阅读(5936)  评论(1编辑  收藏  举报