Handy ‘which’ command on Windows

VERY handy!

1
2
3
4
5
6
7
8
9
10
 @echo off
rem --------------------------------------------------------
rem File: which.cmd
rem Description: Windows equivalent of Unix which command
rem Author: Pankaj Kumar
rem Copyright 2004 Pankaj Kumar. All Rights Reserved.
rem License: This software is available under GPL (http://www.gnu.org/licenses/gpl.html)
rem ---------------------------------------------------------
setlocal
if "%1" == "" goto noArg

set fullpath=%~$PATH:1
if “%fullpath%” == “” goto notFound
echo Found in PATH: %fullpath%
goto end

:noArg
echo No Argument specified
goto end

:notFound
echo Argument “%1″ not found in PATH

:end
endlocal

Share this:
Facebook Linkedin Twitter Digg Email

Leave a Reply