Read this article to know details of EXIST and all the other batch file commands.
Batch File If Else Example To Check If A File Or Folder ExistsĮXIST command is used to check if a file exists or not. IF %name1%=%name2% (echo Name is Same) ELSE (echo Name is different)īatch File If Else Example To Check If Variable Is Defined Or Not OFFĮither way, it will set var to 'Hello' as it is not defined previously. IF %a%=%b% (echo Numbers are equal) ELSE (echo Numbers are different)
To know in depth and details about batch file variables, go through this article. Batch File If Else Example: Checking Integer Variables And String Variables