@ISABATCH — Looks for a matching batch file.

Syntax:
%@ISABATCH[file,path,flags]

filethe command to search for; no path, no extension, no wildcards
pathdirectories to search; defaults to %PATH
flagsbitmapped: 1: search current dir before path; 2: also search AppPaths; 128: return filename

@ISABATCH searches for a matching command, and returns a numeric value:

0no matching command was found
0the first matching command is not a batch (.com or .exe)
1the first matching command is a .btm
2the first matching command is a .cmd
3the first matching command is a .bat

The flags value lets you alter the function’s operation:

1search the current directory before the search path
2search AppPaths after the search path
128return the first matching filename, not a numeric value

If flags is not specified, it defaults to 1.

You can specify a different list of directories to search with path. Separate directories with semicolons (not commas!) and quote any directory which contains a space, comma, semicolon, or other troublesome character.


iff %@isabatch[empire] == 0 then
    echo Empire is not a batch file.
else
    echo Empire is a batch file:  %@isabatch[empire,,128]
endiff