Can't run exe file using System.Diagnostics.Process
Can't run exe file using System.Diagnostics.Process
07 Nov 2022, 10:10
protected override void OnStart()
{
var program = new Process {
StartInfo = {
FileName = "python.exe",
WorkingDirectory = @"C:\Users\alan\AppData\Local\Spotware\cTrader\4a28ae902aa17e9068eea37241a33c59\app_4.2.22.8450",
Arguments = "d:/программирование/python/test.py"
}
};
program.Start();
}
When I run this code, there is a message in the log: 'Crashed in OnStart with Win32Exception: An error occurred trying to start process 'python.exe' with working directory 'C:\Users\alan\AppData\Local\Spotware\cTrader\4a28ae902aa17e9068eea37241a33c59\app_4.2.22.8450'. Unknown error (0x2)'
However, it works in Visual Studio in console app, and python file executes.
winsonet
18 Feb 2023, 14:23 ( Updated at: 21 Dec 2023, 09:23 )
RE:
it's need to use the below for .Net 6
medvedilich said:
@winsonet