I'm quite new in this terminal topic, I'm using Windows PowerShell and I was trying to solve a Postgres bug.
I checked out some posts here that solved the problem but I saw that people used "which" to look the directory of a file, I wrote it in my console and I the command doesn't work. The thing is that I'd searched how to use this command in PowerShell and I created it didn't work and every time I open PowerShell, this error message appears in my screen:
New-Alias : The alias is not allowed, because an alias with the name 'which' already exists.
New-Alias which get-command
CategoryInfo : ResourceExists: (which:String) [New-Alias], SessionStateException
FullyQualifiedErrorId : AliasAlreadyExists,Microsoft.PowerShell.Commands.NewAliasCommand
I want to fix this but I don't know how, I need help :(
CodePudding user response:
If there were two aliases for "which", Powershell would not know which one you mean in a script.
You can list existing aliases and remove them, then create it again with the value you want.
Get-Alias -Name which
Remove-Alias -Name which
There are some existing questions about permanently setting up a new alias and editing your profile. e.g. How to create permanent PowerShell Aliases