Saturday, 1 December 2018

windows 7 - Is it possible to detect file location when running it?



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 ?



Answer



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).


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...