My question is simple. I want to run a Windows command that always exits with a non-zero value on each run. I don't have access to command itself and want to manipulate the exit code when I call it. Sth like this:
C:\>run.cmd || echo "OK"
How can I achieve this?
Thanks in advance.
In Windows command line, "echo" is not interpreted as a command and return code is not calculated. Thus, you have to use some other command. For your case, below code would be allright:
C:\>run.cmd || exit 0;
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