Unfortunately, there doesn't seem to be any kind of related command for DOS. Happily, a user named Mechanix2Go posted a hackish version which you can save as a batch file. I've made a couple of minor tweaks, to suppress file not found errors and fix the frankly idiotic treatment by DOS of the PATH variable as a set of tokens delimited by spaces. Some horrible hackery was taken from here to partially work around the problem. It will still fall over on weird paths with a ';' in them, and it'll echo double quotes.
Trying to express yourself in DOS batch language is like trying to compose a symphony using only two piano strings.
@echo off & setLocal EnableDelayedExpansion if %1'==' goto :eof for %%a in ("%path:;=";"%") do ( dir /b %%a 2>&1 | findstr /i /b /c:"%1.exe" /c:"%1.bat" /c:"%1.com" > nul if not errorlevel 1 echo %1 is in %%~a && goto :eof )
No comments:
Post a Comment