1.

Solve : Using IF in a batch file?

Answer»

I want to create a batch file that starts out by CHECKING if a certain file exists. If the file exists then the rest of the batch file will run, if not it will exit: Like this

If file exists
do CODE
Else
Exit

Can anyone tell me what syntax I would need for this ?

thanks in advance

DanIf not EXIST <path><filename> goto :none
[code to executed]
goto :END
:none
echo File does not exist - no action taken
:end

If you want to GET fancy, you can keep the message on screen for x number of seconds and exit automatically. For immediate termination, simply type exit following :end



Discussion

No Comment Found