Inside Man
Inside Man

Reputation: 4309

Skip Error Messages In Batch Scripts

I have a very simple batch script.

Start "" "C:\Game.exe"

If Game.exe does not exist, it will show an error message that there is no game.exe. I want to skip such messages, I mean if game.exe exists it runs it and if no nothing.

How to do it?

Upvotes: 1

Views: 1221

Answers (2)

legrandviking
legrandviking

Reputation: 2424

if exist "C:\Game.exe" Start "" "C:\Game.exe"

Upvotes: 3

Leo Chapiro
Leo Chapiro

Reputation: 13979

For example like this:

if not exist "C:\Game.exe" goto ERROR1

Start "" "C:\Game.exe"

:ERROR1

Upvotes: 2

Related Questions