I want to check on whether the last character(s) of an environment variable are \
or .exe
. How can I do this in Windows XP SP3?
Answer
To use substrings:
set _parm1=foo.exe
if [%_parm1:~-1%]==[\] echo ends with \
if /i [%_parm1:~-4%]==[.exe] echo ends with .exe
You replace the number before the % sign to alter how many characters it checks at the end of the string.
No comments:
Post a Comment