Hassan의 대답 (내 비슷한 문제를 해결 함)에서 설명한 것처럼 Process.Start()에서 반환 된 종료 코드는 실행 파일의 위치, 특히 어떤 디렉토리에 있는지에 따라 영향을받습니다. 여기에 사용한 코드가 있습니다. :
string yourExe = "C\\Program Files\\Your Directory\\YourExe.exe";
string currentDir = Directory.GetCurrentDirectory();
string yourExeDir = "C\\Program Files\\Your Directory";
try
{
Directory.SetCurrentDirectory(yourExeDir);
}
catch (DirectoryNotFoundExeption dnfe)
{
MessageBox.Show("The specified directory does not exist. " + dnfe.Message);
}
if (!File.Exists(yourExe))
{
MessageBox.Show("Can't find yourExe");
}
else
{
Process.Start(yourExe);
}
try
{
//Set the current directory.
Directory.SetCurrentDirectory(currentDir);
}
catch (DirectoryNotFoundException dnfe)
{
MessageBox.Show("The specified directory does not exist. " + dnfe.Message);
}
이것은 현재 작업 디렉터리를 .exe가있는 디렉터리로 전환하고 실행 한 다음 이전 작업 디렉터리가 있던 위치로 다시 전환합니다.
실제 세부 정보가 없으면 누가 알겠습니까? 어떤 도구? 근원이 있니? 문서가 있습니까? 종료 코드를 설명합니까? 환경이 동일합니까? 등등. – leppie
* 어떻게'Process.Start'를 호출합니까? * – Adam
도구는 회사 내부입니다. –