Computing.Net > Forums > Disk Operating System > IF EXIST

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

IF EXIST

Reply to Message Icon

Name: ray
Date: November 5, 2001 at 16:28:35 Pacific
Comment:

How do you use the if exist command in a batch file? Like if c:\bob.txt exist, run c:\bob.exe. If not, then run no_bob.exe.

TIA



Sponsored Link
Ads by Google

Response Number 1
Name: astroraptor
Date: November 5, 2001 at 17:33:14 Pacific
Reply:

IF EXIST "C:\BOB.TXT" CALL C:\BOB.exe
IF NOT EXIST "C:\BOB.TXT" CALL C:\NO_BOB.exe


0

Response Number 2
Name: A.H.
Date: November 7, 2001 at 07:37:27 Pacific
Reply:

I don't think it's needed to use CALL when not calling a batch file.


0

Response Number 3
Name: DoOMsdAY
Date: November 7, 2001 at 09:32:49 Pacific
Reply:

"CALL" says essentially "run this program, and when it exits, continue execution of this Batch" - which is generally how it works, so long as the program doesn't mess things up. I used to use "CALL" for games and they'd never return to the Batch, but for much everything else it worked great. So it's either necessary or not, depending on how you want your Batch to react.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: IF EXIST

If exist any directory? www.computing.net/answers/dos/if-exist-any-directory/1407.html

if-exist-dir www.computing.net/answers/dos/ifexistdir/2530.html

IF EXIST www.computing.net/answers/dos/if-exist/9621.html