Does anyone knows why I'm getting this error (not every time but sometimes) when trying to start one console application from another. Error:
System.ComponentModel.Win32Exception (0x80004005): Unknown error (0xfffffffe) at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start()
this is my Code:
System.Diagnostics.Process myProc = new System.Diagnostics.Process();
try
{
myProc.StartInfo.FileName = @"C:\MyFolder\MyExecutableApplication.exe";
myProc.Start();
myProc.WaitForExit();
procesResult = myProc.ExitCode;
}
catch (Exception ex)
{
cLog.WriteLog("problem", ex.ToString(), myConfig.LogPath);
}
finally
{
if (myProc != null)
{
myProc.Close();
}
}
Thank you
I guess it's the permission problem. Try this
myProc.StartInfo.UseShellExecute = false;
myProc.StartInfo.RedirectStandardOutput = true;
myProc.StartInfo.RedirectStandardError = true;
reference from this comments
It seems like an permission elevation problem(although I do not know the reason you get the error sometimes); try adding;
myProc.StartInfo.Verb = "runas";
I faced with the same issue. Try to turn off UAC
and add exception to windows defender
(or another security tool)
User contributions licensed under CC BY-SA 3.0