我的 CMD 里有需要执行一个外部命令,在C# winform 里执行 CMD 文件时,提示 外部命令执行是出错:xxx.exe is not internal or external command. 如果我必须通过 CMD 文件调用这个外部命令 xxx.exe,象这个问题我怎么解决?我用过 process, 但是还是提示一样。

解决方案 »

  1.   

    Procees的StartInfo.Arguments设置为那个命令
      

  2.   

    麻烦能解释一下细节吗:是将 xxx.exe 还是将那个 cmd 文件设置为命令?
      

  3.   

    附上代码吧,这样清楚些, xxx.exe是在 copy.cmd里面调用的,但是运行结果显示 xxx.exe 是外部命令不能调用, 求解:     public void CopyFile()
            {
                Process MassDelete = Process.Start("d:\\copy.cmd");
                MassDelete.StartInfo.CreateNoWindow = false;
                MassDelete.StartInfo.UseShellExecute = true;
                MassDelete.StartInfo.RedirectStandardOutput = true;
                MassDelete.WaitForExit();        }
      

  4.   

    最简单的办法,把xxx.exe丢去和你的程序一个目录