My issue is that i get no output when i execute the given command.
The exe takes quite a while to finish and while it's executing im expecting a continuous flow of data being outputed.
But for some reason it seems my program simply ignores the output specifically from the exe.
I feel like i've tried everything and with no luck.
I've tried other commands such as "tree c:/" and im able to receive that output just fine.
Im certain the command im executing is valid.
I have tested the command by itself in a seperate cmd and it works without any problems.
I have also tried running the process on only the exe. This also yielded to output.
I've been stuck with this for a while now, so any help would be much appreciated.
Task.Run(() =>
{
string command = downloadPath + @"\myinstall.exe quickinstallall";
var startInfo = new ProcessStartInfo("cmd.exe")
{
WorkingDirectory = downloadPath,
UseShellExecute = false,
RedirectStandardInput = true,
RedirectStandardError = true,
RedirectStandardOutput = true,
WindowStyle = ProcessWindowStyle.Normal,
CreateNoWindow = false,
Verb = "runas"
};
Process cmd = new Process { StartInfo = startInfo };
cmd.EnableRaisingEvents = true;
cmd.OutputDataReceived += UpdateOutput;
cmd.ErrorDataReceived += UpdateOutput;
cmd.Start();
cmd.BeginOutputReadLine();
cmd.StandardInput.WriteLine(command);
cmd.BeginErrorReadLine();
cmd.WaitForExit();
});