PowerShell Profile with Permanent Aliases

If you're a PowerShell-user who manually runs scripts or binds an alias every time you open PowerShell, then there is a file you really should know about. It's the PowerShell profile-file (or actually, the six profile-files).

I use the profile-file for Current User in the console located here:

%UserProfile%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

When you've ensured that this file is created you can enter PowerShell-scripts that will run every time you open your PowerShell-console. Ensure that your execution policy is configured to support this:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted

For example you can create a PowerShell-alias for the git-command to work with just using g instead:

set-alias g git

Now I can just type g status and save many, many seconds and key-strokes during a long week of Git-usage.

Comments