Yesterday I wrote about getting started with PowerShell but in order to make certain things persist, such as aliases, they need to be created each time the shell starts in the “profile” start-up script.

Location of the profile

The profile file’s location is held in the profile variable and can be seen using this command (echo is aliased to Write-Output by default):

Write-Output $profile

Creating the profile

The profile may not exist yet, and neither might the file it exists in, the easiest way to create it is to use the New-Item command:

New-Item –type file –force $profile

Creating aliases in the profile

Adding the command to create the alias to the file created - for example:

New-Item -Path Alias:subl -Value 'C:\Program Files\Sublime Text 3\subl.exe' | Out-Null

Note the use of Out-Null to suppress the commands output, otherwise you will be told it has created each of the aliases in the file every-time you start a shell.