@SEARCH[program[,path[,n]]] :  Searches for program using the specified path, or, if not specified, the PATH environment variable, appending an extension if one isn't specified. (See Executable Files and File Searches for details on the default extensions used when searching PATH, the order in which the search proceeds, and the search of the \WINDOWS and \WINDOWS\SYSTEM directories.)  Returns the fully expanded name of program, including drive, path, base name, and extension, or an empty string if a match is not found. If wildcards are used in the program, @SEARCH will search for the first program file that matches the wildcard specification, and returns the drive and path for that file plus the wildcard filename (e.g., E:\UTIL\*.EXE).


@SEARCH supports regular expressions in program.


Program and each directory specification in path must be in quotes if they contain white space or special characters.  @SEARCH will add double quotes to the result if it contains whitespace or special characters.


@SEARCH accepts an optional third parameter specifying whether to search the current directory. If n is 0, @SEARCH will not look for the file in the current directory. If n is 1 (the default), @SEARCH will look in the current directory before searching the path.




echo %@search[notepad]



echo %@search[msv*.dll,"d:\my dir\"]

"D:\my dir\test\msvc.dll"