I have made a template batch script that I can tell to carry out a function. I usually use it for pointing to files or locations, in this case, I want it to find and highlight a file and throw a custom error if the target isn't present. Whether the target is present or not, my script throws my error. What am I doing wrong or missing?
Here is my script:
SET TARGETPATH= "%TARGETPATH%" IF NOT EXIST= "%TARGETPATH%" GOTO :ERROR %SystemRoot%\explorer.exe /select, "%TARGETPATH%" :END :ERROR SET msgboxTitle=%TITLE% SET msgboxBody=%MESSAGE% SET tmpmsgbox=%TEMP%\Message.vbs IF EXIST "%tmpmsgbox%" DEL /F /Q "%tmpmsgbox%" ECHO msgbox "%msgboxBody%",0,"%msgboxTitle%">"%tmpmsgbox%" WSCRIPT "%tmpmsgbox%" :END
I have moved and adjusted he position of line 3 (the target selector) to many different positions to prevent the error in a successful target acquisition. I have even set a
:END after the selector among many other things. How can I get this script to throw the error if, and only if the specified target isn't present?