c#带参数的进程exe给出了错误

时间:2016-07-13 22:33:07

标签: c# cmd process arguments exe

我有点陷入应该是一个小问题。我需要运行两个不同的进程,但第二个失败。

我的第一个过程是:

        string workingDirectory = "c:\\xxxx\\bin\\";
        string fileName = "xxxx.xxxx.cmd";
        string arguments = "-Sxxxx -f -d --port xxxx > c:\\xxxx\\tmp\\bug.log 2>&1";

        ProcessStartInfo startInfo = new ProcessStartInfo();
        startInfo.WorkingDirectory = workingDirectory;
        startInfo.FileName = fileName;
        startInfo.Arguments = arguments;

        Process process = new Process();
        process.StartInfo = startInfo;
        process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        process.Start();

不用担心。一切正常,但第二个。

        string workingDirectory = "c:\\xxxx\\bin\\";
        string fileName = "WebDaemon.exe";
        string arguments = "-debug -i WebDaemon.xxxx.1234 --ServerPort=4444 --MultipleServerPorts=1 --CGIPort=4500 --CGICallbackPort=4600 --MinServerProcs=2 --MaxServerProcs=2 > c:\\xxxx\\tmp\\WebDaemonTrace.log 2>&1";

        ProcessStartInfo startInfo = new ProcessStartInfo();
        startInfo.WorkingDirectory = workingDirectory;
        startInfo.FileName = fileName;
        startInfo.Arguments = arguments;

        Process process = new Process();
        process.StartInfo = startInfo;
        process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        process.Start();

给出错误。该过程已创建并显示在taskmanager中,但在5秒后它将消失。此外,我可以在调试消息中读取: "命令行参数'>'不知道"

我似乎无法找到问题所在。接受任何建议: - )

0 个答案:

没有答案
相关问题