I have a command mycommand
that sometimes gives a bad exit code, but I want to continue executing the script. However, I don't want to disable exiting on bad exit codes for the other lines.
On Linux systems I can change the command to mycommand || true
which will ensure that this line always succeeds. How can I do this on Windows in PowerShell? If I try || true
as-is, PowerShell says "The token '||' is not a valid statement separator in this version". What's the equivalent in PowerShell?