Skip to content

Instantly share code, notes, and snippets.

@DNNX
Created July 19, 2011 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DNNX/1092023 to your computer and use it in GitHub Desktop.
Save DNNX/1092023 to your computer and use it in GitHub Desktop.
Windows equivalent of Unix which command by Pankaj Kumar
@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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment