leventunver
leventunver

Reputation: 3399

How can I run a Windows command and return true everytime?

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.

Upvotes: 5

Views: 3789

Answers (1)

Doruk Kutluay
Doruk Kutluay

Reputation: 196

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;

Upvotes: 10

Related Questions