Is there an equivalent of 'which' on the Windows command line?
modern equivalent definition
equivalent or equivalence
As I sometimes have path problems, where one of my own cmd scripts is hidden (shadowed) by another program (earlier on the path), I would like to be able to find the full path to a program on the Windows command line, given just its name.
Is there an equivalent to the UNIX command 'which'?
which command prints the full path of the given command to easily find and repair these shadowing problems.
Windows Server 2003 and later (i.e. anything after Windows XP 32 bit) provide the
where.exe program which does some of what
which does, though it matches all types of files, not just executable commands. (It does not match built-in shell commands like
cd.) It will even accept wildcards, so
where nt* finds all files in your
%PATH% and current directory whose names start with
where /? for help.
Note that Windows PowerShell defines
where as an alias for the
Where-Object cmdlet, so if you want
where.exe, you need to type the full name instead of omitting the
Equivalent TO or OF, The most common preposition used with this adjective is to: 150 grams are equivalent to a medium-sized potato. James thought retiring was So, There is no ap for that! Too bad, trying to remember all those key board short cuts takes some of the glamor out of Apple. I did try that and it did work. Thanks. Yes, there is an app for that. You got an incomplete answer.
While later versions of Windows have a
where command, you can also do this with Windows XP by using the environment variable modifiers, as follows:
c:\> for %i in (cmd.exe) do @echo. %~$PATH:i C:\WINDOWS\system32\cmd.exe c:\> for %i in (python.exe) do @echo. %~$PATH:i C:\Python25\python.exe
You don't need any extra tools and it's not limited to
PATH since you can substitute any environment variable (in the path format, of course) that you wish to use.
And, if you want one that can handle all the extensions in PATHEXT (as Windows itself does), this one does the trick:
@echo off setlocal enableextensions enabledelayedexpansion :: Needs an argument. if "x%1"=="x" ( echo Usage: which ^<progName^> goto :end ) :: First try the unadorned filenmame. set fullspec= call :find_it %1 :: Then try all adorned filenames in order. set mypathext=!pathext! :loop1 :: Stop if found or out of extensions. if "x!mypathext!"=="x" goto :loop1end :: Get the next extension and try it. for /f "delims=;" %%j in ("!mypathext!") do set myext=%%j call :find_it %1!myext! :: Remove the extension (not overly efficient but it works). :loop2 if not "x!myext!"=="x" ( set myext=!myext:~1! set mypathext=!mypathext:~1! goto :loop2 ) if not "x!mypathext!"=="x" set mypathext=!mypathext:~1! goto :loop1 :loop1end :end endlocal goto :eof :: Function to find and print a file in the path. :find_it for %%i in (%1) do set fullspec=%%~$PATH:i if not "x!fullspec!"=="x" @echo. !fullspec! goto :eof
It actually returns all possibilities but you can tweak it quite easily for specific search rules.
Equivalent, Equivalent definition is - equal in force, amount, or value; also : equal in area or volume but not superposable. How to use equivalent in a sentence. Did You Equivalent equations are systems of equations that have the same solutions. Identifying and solving equivalent equations is a valuable skill, not only in algebra class but also in everyday life. Take a look at examples of equivalent equations, how to solve them for one or more variables, and how you might use this skill outside a classroom.
Get-Command will find executables anywhere in
Get-Command eventvwr CommandType Name Definition ----------- ---- ---------- Application eventvwr.exe c:\windows\system32\eventvwr.exe Application eventvwr.msc c:\windows\system32\eventvwr.msc
It also finds PowerShell cmdlets, functions, aliases, files with custom executables extensions via
$Env:PATHEXT, etc. defined for the current shell (quite akin to Bash's
type -a foo) - making it a better go-to than other tools like
which.exe, etc which are unaware of these PowerShell commands.
Finding executables using only part of the name
gcm *disk* CommandType Name Version Source ----------- ---- ------- ------ Alias Disable-PhysicalDiskIndication 126.96.36.199 Storage Alias Enable-PhysicalDiskIndication 188.8.131.52 Storage Function Add-PhysicalDisk 184.108.40.206 Storage Function Add-VirtualDiskToMaskingSet 220.127.116.11 Storage Function Clear-Disk 18.104.22.168 Storage Cmdlet Get-PmemDisk 22.214.171.124 PersistentMemory Cmdlet New-PmemDisk 126.96.36.199 PersistentMemory Cmdlet Remove-PmemDisk 188.8.131.52 PersistentMemory Application diskmgmt.msc 0.0.0.0 C:\WINDOWS\system32\diskmgmt.msc Application diskpart.exe 10.0.17... C:\WINDOWS\system32\diskpart.exe Application diskperf.exe 10.0.17... C:\WINDOWS\system32\diskperf.exe Application diskraid.exe 10.0.17... C:\WINDOWS\system32\diskraid.exe ...
Finding custom executables
To find other non-windows executables (python, ruby, perl, etc), file extensions for those executables need to be added to the
PATHEXT environmental variable (defaults to
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL) to identify files with these extensions in the
PATH as executable. As
Get-Command also honours this variable, it can be extended to list custom executables. e.g.
$Env:PATHEXT="$Env:PATHEXT;.dll;.ps1;.psm1;.py" # temporary assignment, only for this shell's process gcm user32,kernel32,*WASM*,*http*py CommandType Name Version Source ----------- ---- ------- ------ ExternalScript Invoke-WASMProfiler.ps1 C:\WINDOWS\System32\WindowsPowerShell\v1.0\Invoke-WASMProfiler.ps1 Application http-server.py 0.0.0.0 C:\Users\ME\AppData\Local\Microsoft\WindowsApps\http-server.py Application kernel32.dll 10.0.17... C:\WINDOWS\system32\kernel32.dll Application user32.dll 10.0.17... C:\WINDOWS\system32\user32.dll
You can quickly set up an alias with
sal which gcm (short form of
set-alias which get-command).
More information and examples can be found under the online help for
equivalent to vs equivalent of, It seems strange that you're comparing a dollar to a dollar, so you should specify what dollar (US, Hong Kong, Canadian etc.) the first one is Equivalent in what way, we wonder? If you mean made half or more of injection molded polymer, sure. There are many shotguns on today's market made largely of polymer with metal only used where needed for strength.
In Windows PowerShell:
set-alias which where.exe
Use equivalent in a sentence, How to use equivalent in a sentence. Example sentences with the word equivalent. equivalent example sentences. There is a medication called Effexor that is available in generic form. It may be an alternative that you can try if your doctor deems it to be therapeutically equivalent to treat your disorders. You can also contact your insurance company to find out what medications are on their drug formulary which are equivalent that they cover.
If you have PowerShell installed (which I recommend), you can use the following command as a rough equivalent (substitute programName for your executable's name):
($Env:Path).Split(";") | Get-ChildItem -filter programName*
More is here: My Manwich! PowerShell Which
What is the difference between equivalent of and equivalent to, "Equivalent of" would be used with the word as a noun: "Eating pasta with a spoon is the equivalent of driving with a scooter." "Equivalent to" 2 Answers (question resolved) - Posted in: generic, xarelto - Answer: My insurance won't even pay for it. Plavix was used and it has a generic.
EQUIVALENT, equivalent meaning: 1. having the same amount, value, purpose, qualities, etc.: 2. something that has the same amount…. Learn more. An 84 year old friend is paying a fortune for Advair. I am hoping that there may be a generic equivalent or if not, another medication that we might try that might not be as costly for a person on a fixed income.
How to Use Equivalent with Example Sentences, Used with verbs: "The assignments are equivalent in difficulty." (be: is/am/are; seem, appear) " Amazon's Choice for battery lr1130 equivalent. 2PC Maxell LR1130 189 389 Alkaline Coin Cell Battery. 4.5 out of 5 stars 681. $1.99 $ 1. 99 ($1.00/Count) FREE Shipping.
Equivalent Fractions Calculator, They have different numerators and denominators, but their fractional values are the same. For example, think about the fraction 1/2. It means half of something. Is there an equivalent of SU for Windows. Ask Question Asked 11 years ago. Active 8 years, 2 months ago. Viewed 43k times 32. 11. Is there a way (when logged in as an
- Foredecker: "which" searches the PATH for the executable that will be run if you type a command at the shell prompt.
- for example, if you have 5 versions of Java installed and you don't know which one is being used you can type "which java" and it gives you the PATH to the binary
- @Foredecker, MR says it's "where" in Win2k3 but Win2k3 wasn't part of the question. If "where" isn't in the other Windows versions, other answers are also valid. IMNSHO, the answer that works on all Windows versions is the best. Also, the other answers aren't wrong, just different ways of doing it.
- I know this question arose before SuperUser, but it probably belongs there.
- There is no
whichcommand in standard Unix. The POSIX utility is
type. The C Shell has a which command, and some systems have it as an external executable. For instance, on Debian Linux,
whichcomes from a package called
debutils. This external
whichdoes not "see" shell built-ins, aliases or functions.
typehas an option to suppress that and just do a path lookup.
- No, because grep examines the contents of its input, which you have to give explicitly. which and where.exe only look at the names of the files in a set of directories set in the PATH environment variables.
- @Ajedi32 - Correct, which is not in XP. As I said, "Windows Server 2003 and later".
- Works in Windows 8
- watch out that this wont work in powershell unless you type where.exe
- Remember that
where.exeis not a shell builtin, you need to have
%PATH%- which may not be the case, as using
wheresuggests that you may be working on problems with your path!
- Hey, I wish I had learned that! Too bad it doesn't work with MS-DOS or Win9x (that is, with command.com). (Raymond Chen has a more "elaborate" version you can turn into a batch file: blogs.msdn.com/oldnewthing/archive/2005/01/20/357225.aspx )
- @Michael, if you're still using DOS or Win95, finding executables on the path are the least of your problems :-)
- windows recognizes more than .exe as executable. Last time I coded a
whichback in W95/DOS days amdittedly, the search order was - current dir, then each path dir, for cmd.com, then cmd.exe, then cmd.bat So, even cmd.bat in current dir is executed befroe cmd.exe soemwhere in path