mardi 16 juin 2020

The property "Redirectstandarderror" on process startinfo used in reflection is not opening the console window

I have a requirement to start a process using reflection.Below is the piece of code I'm trying to execute using reflection.

Process newProcess = new Process();
ProcessStartInfo startInfo =new ProcessStartInfo(filepath);
startInfo.UseShellExecute = false;
startInfo.RedirectStandardError = true;
startInfo.CreateNoWindow=false;
newProcess.StartInfo = startInfo;
newProcess.Start();
newProcess.WaitForExit();

Using this code,my console is not getting opened.If I remove UseShellExecute and RedirectStandardError,I was able to see the console.I tried different ways using allocconsole as well.But nothing seems to be worked out.





Aucun commentaire:

Enregistrer un commentaire