How do I ask PowerShell where something is?
For instance, "which notepad" and it returns the directory where the notepad.exe is run from according to the current paths.
Use Get-Command as the Equivalent of Which Command in PowerShell. The Get-Command cmdlet displays all commands installed on the computer, including cmdlets , aliases , functions , filters , scripts , and applications .
$_ in the PowerShell is the 'THIS' toke. It refers to the current item in the pipeline. It can be considered as the alias for the automatic variable $PSItem.
The & operator in PowerShell is just the ; or Semicolon. The && operator in PowerShell has to be run as an if statement.
The very first alias I made once I started customizing my profile in PowerShell was 'which'.
New-Alias which get-command
To add this to your profile, type this:
"`nNew-Alias which get-command" | add-content $profile
The `n at the start of the last line is to ensure it will start as a new line.
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