C#:执行EXE文件

时间:2015-05-12 16:06:58

标签: c# mono exe processstartinfo

我读到了其他答案,但我的工作不行。也许是因为差异。 区别在于我的hex文件位于外部设备上,这是层次结构

/home/root/myfolder/General

和我想要执行的EXE

/TestLiberatus_Stress.exe

所以这就是我现在所拥有的

string ex1 = "/home/root/myfolder/Functional/TestLiberatus_Stress.exe";

// Use ProcessStartInfo class
ProcessStartInfo startInfo = new ProcessStartInfo();

startInfo.CreateNoWindow = false;
startInfo.UseShellExecute = false;
startInfo.FileName = ex1;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.Arguments = "";

try
{
    // Start the process with the info we specified.
    // Call WaitForExit and then the using statement will close.
    using (Process exeProcess = Process.Start(startInfo))
    {
        exeProcess.WaitForExit();
    }
}
catch
{
    int x = 0; //just to know it enters for now
}

从我发现的其他解释中,它应该有效......那么,问题出在哪里? 此外,一旦这项工作,我想做的完整路径将是上升到一个水平并进入压力。执行的EXE将在我给出的路径中,完整路径,另一个要执行的路径将在

/home/root/myfolder/Functional

0 个答案:

没有答案