1

Say I have a file called calc.exe ( for example).

When I go to CMD and I run calc.exe it runs because Windows has PATH settings in its environment variables.

Path information is also accessible via typing path in cmd. ( as we all know).

Question

But - Is there any command in cmd that shows me information like this :

c:\> locate_Where_It_Will_run_From calc.exe

Response :

c:\windows

I mean , the only solution which I see now is to run :

dir /s  calc.exe

And then to match results with the PATH information .

Is there any such command which will show me the information of my example above ?

DavidPostill
  • 153,128
  • 77
  • 353
  • 394
Royi Namir
  • 5,598
  • 14
  • 47
  • 70
  • I don't think this question should be closed. PC/win users don't know what "which" command is , and probably don't use unix . It is a pure perspective in a windows world and should not be closed as duplicated as an alternative to "which" because people might not know what is "which" at first place. ( — but as your wish....) – Royi Namir Nov 10 '15 at 09:31

1 Answers1

2

On recent Windows systems, the command is where:

> where calc
c:\windows\system32\calc.exe

> where where
c:\windows\system32\where.exe

PowerShell has Get-Command for the same purpose.

Note that where only covers %PATH%, but launching apps via "Run…" via Start menu additionally uses App Paths from the Registry.


The Unix equivalents are which (-a) and type (-a) (the latter also includes shell-builtins).

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966