As the title implies, when I am trying to where python from PowerShell it returns nothing. No errors or something... it just goes to a new line (as if I pressed "Enter")
On the other hand, CMD Prompt successfully returns the following:
C:\Users\User>where python
C:\Users\User\AppData\Local\Programs\Python\Python38\python.exe
C:\Users\user\AppData\Local\Microsoft\WindowsApps\python.exe
python --version successfully returns the version in both pwsh and cmd. Can someone figure how to fix where in powershell ?
In PowerShell, where is an alias for the Where-Object cmdlet.
To explicitly invoke where.exe, include the .exe extension:
PS ~> where.exe python
C:\Users\mathias\AppData\Local\Microsoft\WindowsApps\python.exe
If you want to figure out why a certain command name doesn't resolve as expected, use Get-Command:
PS ~> Get-Command where
CommandType Name Version Source
----------- ---- ------- ------
Alias where -> Where-Object
PS ~> Get-Command where*
CommandType Name Version Source
----------- ---- ------- ------
Alias where -> Where-Object
Cmdlet Where-Object 3.0.0.0 Microsoft.PowerShell.Core
Application where.exe 10.0.19041.1 C:\WINDOWS\system32\where.exe
As an amusing bonus, your newfound knowledge of Get-Command might prove where.exe obsolete - as Get-Command evidently has the ability to locate executables as well :)
PS ~> Get-Command python
CommandType Name Version Source
----------- ---- ------- ------
Application python.exe 0.0.0.0 C:\Users\mail\AppData\Local\Microsoft\WindowsApps\python.exe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With