Here is a windows batch file that will search your path for a file. I have tested it on XP and Win7.
Please understand that a batch/command file is NOT a good solution to this problem because string manipulation is painfully slow - but in lieu of a compiled tool, this will do what you desire.
Hopefully it is commented well enough, but feel free to ask questions if anything needs clarification.
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
rem -- SRC = Search value. Eg. notepad or notepad.exe
rem -- PAT = A copy of the path
rem -- SEP = PATH seperator
rem -- EXE = Executable file extensions
SET TMP_SRC=%1
SET TMP_PAT=%PATH%
SET TMP_SEP=;
SET TMP_EXE=exe com bat cmd
rem -- This is a batch file ...they are s-l-o-w
rem -- "<nul set /p=" does "echo" without a newline
<nul set /p =Searching...
:strLoop
rem -- SUB = The first entry in the current PATH
for /f "delims=%TMP_SEP%" %%s in ("!TMP_PAT!") do set TMP_SUB=%%s
rem -- Progress update
<nul set /p =.
rem -- Check for the file exactly as specified on the command line
if exist "!TMP_SUB!\%TMP_SRC%" (
echo.
echo Found "!TMP_SUB!\%TMP_SRC%"
goto strDone
)
rem -- Check for the file with each of the selected executable extensions
for %%x in (%TMP_EXE%) do (
if exist "!TMP_SUB!\%TMP_SRC%.%%x" (
echo.
echo Found "!TMP_SUB!\%TMP_SRC%.%%x"
goto strDone
)
)
rem -- This loop chops off the first entry of the PATH
:subLoop
rem -- CHR = First character of current PATH
rem -- PAT -> All but the first character of the current PATH
set TMP_CHR=!TMP_PAT:~0,1!
set TMP_PAT=!TMP_PAT:~1!
rem -- Have we exhausted the PATH?
if "!TMP_PAT!" EQU "" goto strDone
rem -- Have we just removed a PATH seperator?
if "!TMP_CHR!" EQU "%TMP_SEP%" goto strLoop
rem -- Keep stripping characters
goto subLoop
:strDone
rem -- Cleanup
SET TMP_SRC=
SET TMP_PAT=
SET TMP_SEP=
SET TMP_SUB=
SET TMP_CHR=
SET TMP_EXE=
ENDLOCAL
truename
does something else.