I want to open a new shell and pass a command for it to execute in a single line of code from the windows cmd window. What is the easiest way to accomplish this?
For example I have a cmd shell and I want to execute:
C:\app\cmd.exe THEN "run_app.exe argument1"
cmd /c run_app.exe argument
to close after executing or
cmd /k run_app.exe argument
to keep open after executing.
If in doubt, use full paths to your executable:
cmd /c c:\path\to\run_app.exe argument
To run several commands one after another, use chaining:
cmd /k run_app.exe argument & second.exe & third.exe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With