Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal Enabledelayedexpansion
- if "%1" == "/?" echo it is which & goto :eof
- if "%1" == "" (
- set /p file=write the file:
- ) else (
- set file=%1
- )
- set fdir=%cd%
- set p=%PATH%
- set p=%cd%;%p%
- :start
- for /f "delims=; tokens=1,*" %%i in ("%p%") do (
- set p=%%j
- set direc=%%i
- cd !direc!
- if EXIST !file! (
- echo !direc!\!file!
- cd "!fdir!"
- goto :eof
- endlocal
- )
- set e=%pathext%
- :ex
- for /f "delims=; tokens=1,*" %%i in ("!e!") do (
- set e=%%j
- set exp=%%i
- )
- if EXIST !file!!exp! (
- echo !direc!\!file!!exp!
- cd "!fdir!"
- goto :eof
- endlocal
- ) else (
- if "!exp!" == ".MSC" (
- goto :start
- ) else (
- goto :ex
- endlocal
- )
- )
- )
- rem if "!p!" == "" (
- echo none
- goto :eof
- endlocal
- rem )
Advertisement
Add Comment
Please, Sign In to add comment