This is the example, a shortcut was installed to this code
:
@echo off
::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
:: $Header: C:/DBAREIS/Projects.PVCS/Win32/ScriptingTipsAndTricks/EXAMPLE[cmd].SearchPath() [search the PATH directory list for a file].cmd.pvcs 1.0 11 Jul 2014 19:31:02 USER "Dennis" $
::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
::--- Say what we are searching ---------------------------------------------
echo SEARCHING PATH:
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PATH
::--- Search for the files --------------------------------------------------
call :SearchPath "RoboCopyExe" "RoboCopy.exe"
call :SearchPath "NOSUCH" "NoSuch.exe"
goto :EOF
:++++++++++++++++++++++++++++++++++++++++++++++
:SearchPath
:: P1 = Name of environment variable to get full file name
:: P2 = short name of file to look for
:++++++++++++++++++++++++++++++++++++++++++++++ NEEDS: ENABLEDELAYEDEXPANSION
set Look4=%~2
echo.&echo.
echo LOOKING FOR: "%Look4%"
for %%E in ("%Look4%") do set Result=%%~$PATH:E
echo FOUND : "%Result%"
if "%Result%" == "" echo WARNING "%Look4%" not found in path...
set %~1=%Result%
goto :EOF