Skip to content

Instantly share code, notes, and snippets.

@AyrA

AyrA/where.bat

Created Nov 2, 2017
Embed
What would you like to do?
where command on Windows
@ECHO OFF
REM Store this anywhere in your PATH.
SETLOCAL
SET FULL=%~$PATH:1
IF "%FULL%"=="" GOTO NF
GOTO PRINT
:PRINT
ECHO %FULL%
GOTO END
:NF
IF "%2"=="" GOTO TRYEXT
GOTO END
SET FULL=(not found)
GOTO PRINT
:TRYEXT
FOR %%I IN (%PATHEXT%) DO CALL "%~0" "%~1%%I" QQ
GOTO END
:END
ENDLOCAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.