I'm trying to launch cmd.exe
from my c# code for debugging, but it seems that setting the UseShellExecute
set to false does not show the window, which is what I would like here.
I do need to set UseShellExecute==false
however to set the environment variables. So is there another way to set the required environment variables and launch the cmd.exe
window?
string ev_path = System.Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine);
string ev_java = System.Environment.GetEnvironmentVariable("JAVA_HOME", EnvironmentVariableTarget.Machine);
string ev_adt = System.Environment.GetEnvironmentVariable("ANDROID_HOME", EnvironmentVariableTarget.Machine);
ProcessStartInfo _pinfo = new ProcessStartInfo
{
WorkingDirectory = home_drive + @"\orderato-android",
FileName = "CMD.exe",
Arguments = "/K ant debug",
UseShellExecute = false
};
_pinfo.EnvironmentVariables["Path"] = ev_path;
_pinfo.EnvironmentVariables["JAVA_HOME"] = ev_java;
_pinfo.EnvironmentVariables["ANDROID_HOME"] = ev_adt;
Process _p = Process.Start(_pinfo);
_p.WaitForExit();