I have an .exe file. I want to run the .exe file with Process.Start()
command. The .exe file produces two files when executed one is .xls file and another one is .htm file. When I run the .exe file through .net code, the two files that are supposed to be produced are not produced. Below is my code:
static void Main(string[] args)
{
Process.Start(@"C:\Test\test.exe");
}
I am not sure if the process is getting executed, but I don't see any error. Also, I don't see any files produced. If I manually run the process then I can see the two files produced in the same folder where the .exe file resides.
Any help will be appreciated.
Try waiting for the process to finish:
Process.Start(@"C:\Test\test.exe").WaitForExit();
Better for debugging:
Process process = Process.Start(@"C:\Test\test.exe");
int id = process.Id;
Process runningProc = Process.GetProcessById(id);
runningProc.WaitForExit();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.