i’m developing a WPF application which use
Process.Start("cmd", "/k ...");
or
Process.Start("cmd", "/c ...");
to execute some commands throw the command line.
is it possible to get a notification when the command line command is executed and the cmd is “free” again?
its because i need to execute some more command, but i need to execute each command after the other.
I’m not sure what you need
cmdhere for. If you want to run one command after another, then just execute them one after another directly. You can giveProcess.Startprograms to execute and batch files too. If you need a shell built-in such asdirthen you can usecmd /cof course, butcmd /krunning in the background seems rather unnecessary to me.In any case,
Process.Startreturns aProcessobject which has a handy methodWaitForExit. So if you don’t start a program that runs indefinitely, ascmd /kthen you can use that to figure out when the command finished.