There is a Windows command "Where" which tells use the location of executable applications. Such as, if you are looking for location of notepad, you can run :
where Notepad
Output:
C:\Windows\System32\notepad.exe
C:\Windows\notepad.exe
This helps you much when there are two versions of same executable and you want to know which will get priority. For example, in the above output, there are two entries for notepad.exe, but when you call notepad without providing full path, it will pick the one located in System32.
The same can be achieved in Powershell with the help of Get-Command cmdlet. This cmdlet will tell you the same output :
get-command notepad
CommandType Name Definition
----------- ---- ----------
Application notepad.exe C:\Windows\system32\notepad.exe
Application notepad.exe C:\Windows\notepad.exe
You can adjust the output with format-table cmdlet. Such as, if you want to get output in form of Name and Definition only, you can try below :
get-command notepad | ft name, definition
That's all for today. Hope you liked this article. Thanks for reading!
where Notepad
Output:
C:\Windows\System32\notepad.exe
C:\Windows\notepad.exe
This helps you much when there are two versions of same executable and you want to know which will get priority. For example, in the above output, there are two entries for notepad.exe, but when you call notepad without providing full path, it will pick the one located in System32.
The same can be achieved in Powershell with the help of Get-Command cmdlet. This cmdlet will tell you the same output :
get-command notepad
CommandType Name Definition
----------- ---- ----------
Application notepad.exe C:\Windows\system32\notepad.exe
Application notepad.exe C:\Windows\notepad.exe
You can adjust the output with format-table cmdlet. Such as, if you want to get output in form of Name and Definition only, you can try below :
get-command notepad | ft name, definition
That's all for today. Hope you liked this article. Thanks for reading!
No comments:
Post a Comment