How to use "IF EXIST" in a package

I need to run a Windows batch file to check for multiple files. I wrote the following batch file code:

dir

if exist {"help/user/Content/learning_home.htm"} { echo file exists} ELSE {echo File Deleted}

if exist {"./archibus.war"} {echo File not deleted!} ELSE {echo File Deleted}
if exist {"./build.xml"} { echo file exists} ELSE {echo File Deleted}

      

When I execute the batch file, the directory listing is displayed correctly and the rest of the commands are just displayed on the command line.

I feel like I am missing something. Any suggestions would be greatly appreciated.

+3


source to share


1 answer


Use regular braces instead of curly braces.



if exist "help/user/Content/learning_home.htm" (echo file exists) ELSE (echo File Deleted)

if exist "./archibus.war" (echo File not deleted!) ELSE (echo File Deleted)
if exist "./build.xml" (echo file exists) ELSE (echo File Deleted)

      

+3


source







All Articles