Category: PowerShell

PowerShell Alias in Profile

PowerShell Alias

If you are like me and spend a large amount of time in the windows PowerShell, the New-Alias Cmdlet is your friend.

What is an Alias

An alias is a way to shorten frequently typed command so that commands like “docker” become “d” and “docker-compose” becomes “dc”.  Basically it is a way to rename any command line tool to make it easier to remember or type.

The Profile file

The profile is a PowerShell script that runs every time you start a PowerShell.  You can put commands in that file that you want to run every time you start a PowerShell.  Below is a copy of my current PwerShell:

The  last two line are my alias for docker commands.  instead of “docker” I type “d”, etc…

To edit this file:

This will search out your $profile path and open it in Notepad.

Put your commands in this file and start a new PowerShell to test it.

Conclusion

This is powerful tool to help automate your environment and can speed up your daily tasks.