我需要模仿这个命令行版本:
如果我在说H:\
并运行:
H:\> D:\MyFolder\MyOtherFolder\TheFile.exe
这将启动TheFile.exe应用程序,但需要像从以下位置启动一样运行:
D:\MyFolder\MyOtherFolder\> TheFile.exe
无论如何让Process.Launch从实际文件夹执行而不是运行启动.exe的代码的app文件夹?
答案 0 :(得分:3)
您可以在Process start中指定工作目录。例如:
AppProcess = new Process();
AppProcess.StartInfo.FileName = "D:\\MyFolder\\MyOtherFolder\\TheFile.exe";
AppProcess.StartInfo.WorkingDirectory = "D:\\MyFolder\\MyOtherFolder";
AppProcess.Start();