I am trying to run a batch file that, in turn, runs a .exe (before you ask, this is necessary). I have tried the answer to this question but the code doesn't work for me. I had been using System.Diagnostics.Process.Start("bat/directory/batname.bat");
but it didn't work; it seemed to open the file but exited it before it could run the .exe
Please help!
EDIT
The codes that I have tried are as follows:
1 - "System.Diagnostics.Process.Start("G:/Software/Games/Files/Minecraft/minecraft.bat/");"
2 -
proc.StartInfo.FileName = target;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
'proc.Start();
'
proc.WaitForExit
(
(timeout <= 0)
? int.MaxValue : timeout * NO_MILLISECONDS_IN_A_SECOND *
NO_SECONDS_IN_A_MINUTE
);
errorMessage = proc.StandardError.ReadToEnd();
proc.WaitForExit();
outputMessage = proc.StandardOutput.ReadToEnd();
proc.WaitForExit();
I know that it is opening because the cmd appears and I see the appropriate code in it.