Check if Windows batch variable starts with a specific string
Use the variable substring syntax: IF “%variable:~0,3%”==”ABC” […] If you need the path to the batch file without the batch file name, you can use the variable: %~dp0 Syntax for this is explained in the help for the for command, although this variable syntax extends beyond just the for command syntax.