Hi. how can I terminate process which was started with cmd /c ? The Kill()
method terminates only that CMD.exe
string cdHome = @"C:\Temp\";
string localhost = "chsaXY";
string userName = "aaa";
string password = "bbb";
string processFile = @"C:\Data.prc";
string temp = @"C:\Temp\";
string args = @" /c " + cdHome + "Notepad.exe " + " -n" + localhost + " -u"
+
userName + " -p" + password + " <" + prozessFile + " >>" + temp +
"testlog.txt";
Process proc = new Process();
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.Arguments = args;
int time = 60000
proc.WaitForExit(time); // wait only with our timeout
if (!proc.HasExited)
{
proc.Kill(); // time is over - kill that process
proc.WaitForExit();
}