What commands do I need in my batch file so that if a file exists, then continue?
File: "c:\users\test\sample.txt"
If the file exists, then continue
How would I go about doing this?
Thanks in advance.
IF EXIST, CONTINUE
Moderator: DosItHelp
Re: IF EXIST, CONTINUE
You can do...
This would only do the command if the file doesn't exist. otherwise it will be ignored and your batch file be executed normally
Code: Select all
if not exist c:\users\test\sample.txt [command if the file doesn't exist]
Re: IF EXIST, CONTINUE
rasil is right. Just reverse the logic.
This bails out if the file doesn't exist. In other words, it continues with the next line if the file exists.
Steffen
Code: Select all
if not exist "blabla.txt" exit /b
Steffen