lundi 20 avril 2015

If Statement fails when I input a del into it

This might be a simple problem, but I'm new to writing batch files. Basically, when I run the code like this:

IF EXIST %ExportFile1% (
echo test1 >> %log_dir%
pause
) ELSE (
echo test2 >> %log_dir%
pause)

The %ExportFile1% just points to a local file. If I run the code with del added, the batch file seems to fail using:

SET do_stuff=false
IF EXIST %ExportFile1% (
echo test1 >> %log_dir%
del %GDriveFile1%
pause
) ELSE (
echo test2 >> %log_dir%
pause)

How should I fix this?

Aucun commentaire:

Enregistrer un commentaire