Launching Daily Tools via Alias

by Oct 4, 2017

You probably know the shortcut names that PowerShell predefines: Aliases like “dir” and “ls” help you save typing in everyday life. There are many good reasons to expand the list of aliases and include tools you use daily.

For example, instead of clicking your way to the SnippingTool screenshot tool, why not add an alias:

 
PS> Set-Alias -Name snip -Value snippingtool.exe

PS> snip
 

Next time you need to copy part of a window into a bug report, simply run “snip” in your PowerShell.

Another potentially useful tool could be osk.exe, your Windows 10 on-screen keyboard, or mstsc.exe to initiate new remote desktop connections.

To persist your aliases, just make sure you add them to your PowerShell profile script. The path can be found here:

 
PS> $profile.CurrentUserAllHosts
C:\Users\username\Documents\WindowsPowerShell\profile.ps1
 

This file initially does not exist. Once you created it, anything in this script will run whenever you start a PowerShell host. You just may need to enable script execution once:

 
PS> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Force
 

Twitter This Tip! ReTweet this Tip!