改成下面试下
pro.StartInfo.Arguments = "/c " + @"C:\TEST.BAT";

解决方案 »

  1.   

    会不会是系统环境变量的问题? 检查一下环境变量. 试试把cmd.exe的全文件路径一起下去试试.如果可以,那么就是环境变量的问题了.如果还不行的话,检查正常的机器跟不正常的机器在操作系统等各个方面有什么不同,以及补丁情况.
      

  2.   

    pro.StartInfo.FileName= "CMD.EXE";
    Change to 
    pro.StartInfo.FileName= "C:\windwos\system32\CMD.EXE";Try
      

  3.   

    下面是我写的用于调用其它进程的通用函数
    --------------------------------------------------------
    public static void Excute(string cmdText)
    {
       Process   p   =   new   Process();   
       p.StartInfo.FileName   =   "cmd.exe";   
       p.StartInfo.UseShellExecute   =   false;   
       p.StartInfo.RedirectStandardInput   =   true;   
       p.StartInfo.RedirectStandardOutput   =   true;   
       p.StartInfo.RedirectStandardError   =   true;   
       p.StartInfo.CreateNoWindow   =   true;  
       p.Start(); 
       p.StandardInput.WriteLine("\""+cmdText+"\"");       
       p.StandardInput.WriteLine("exit"); 
       while(!p.HasExited)
       {
    p.WaitForExit();
       }
       p.Close();      
    }
      

  4.   

    测试在中文winxp,2000,2003均可以运行,桌面上的程序也可以启动
      

  5.   

    我是楼主
    谢谢几位我把C:\windows\system32\CMD.EXE 这个完整路径都写进去了 问题依旧 "/c" 加不加都一样
    公司的机器都是一样的系统 一样的补丁啊 没有什么不一样的地方 
    直接运行批处理文件是绝对没问题的 
    奇怪了。。
      

  6.   

    你是在winform中还是在asp.net中
    在asp.net要 设置相应的用户权限.
      

  7.   

    我是楼主
    程序在winform中 应该没有问题吧
      

  8.   

    System.Diagnostics.Process pro =new System.Diagnostics.Process();
    pro.StartInfo.FileName= "CMD.EXE";
    pro.StartInfo.Arguments = @"C:\TEST.BAT";
    pro.StartInfo.RedirectStandardError = true;
    pro.StartInfo.RedirectStandardInput = true;
    pro.StartInfo.RedirectStandardOutput= true;
    pro.StartInfo.ErrorDialog = true;
    pro.StartInfo.CreateNoWindow = false;
    pro.StartInfo.UseShellExecute= false;
    pro.Start();
    pro.WaitForExit() ;//等待执行
    pro.Close();
    //这样呢.
      

  9.   

    关注一下,请大家帮忙看看这个100分的问题,网址:
    http://community.csdn.net/Expert/topic/5366/5366610.xml?temp=.5854761
      

  10.   

    谢谢 hertcloud(·£孙子兵法£·) 
    还是不行 当pro.Start();以后任务管理器里面根本就没有CMD.EXE
    手动执行这个批处理文件运行的时间应该很长 在管理器里面应该可以查看到的
    所以这个进程并没有被打开。
    为什么打不开呢......
      

  11.   

    public static void CreateProcess(string fn, string Arguments, MsgCallback Callback)
            {
                ProcessStartInfo pi = new ProcessStartInfo();
                pi.FileName = fn;
                pi.Arguments = Arguments;
                pi.UseShellExecute = false;
                pi.CreateNoWindow = true;
                pi.WindowStyle = ProcessWindowStyle.Hidden;
                pi.RedirectStandardOutput = true;
                pi.RedirectStandardError = true;
             
                System.Diagnostics.Process p = new Process();
                
              
                p.StartInfo = pi;
                p.Start();           while (!p.HasExited)
               {               
                   System.Windows.Forms.Application.DoEvents();               if (Callback != null)
                   {
                       string s;
                       while ((s = p.StandardOutput.ReadLine()) != null)
                       {
                           Callback(s);
                       }
                   }
                   p.WaitForExit(100);
               }
               
            }        CreateProcess(dllPath + @"hhc.exe", @" """ + tmpPath + @"\hhp.hhp""", new MsgCallback(OutputHandler));
      
    估计是 路径的问题
      

  12.   

    打开eventvwr看看有什么线索,不行的话再看看DotNetFramework的版本是否相同