Aliases in PowerShell
April 6, 2021
code
# code $PROFILE.CurrentUserAllHosts
code $PROFILE
code
# Aliases for directories
Function goToProjects { Set-Location -Path G:\Projects }
Set-Alias -Name proj -Value goToProjects
- The profile for the current user is at
$PROFILE, but there are other ones for various hosts and all users as well - You can set aliases for commands, but you can not set aliases for commands that also take parameters. The workaround is to save the command with parameters as a function and then have an alias for that function instead of the command