Help with Set-Alias

by Dennis.Rhodes at 2012-11-07 21:33:09

So I am trying to go 100% Powershell, and started to build my profile to load certain cmdlets and what not. However there are a few things that I run daily that I can’t seem to set an alias for. In command line I run a lot of explorer /separate this functionality also works in PS. However I would like to alias it with something shorter. Can someone give me an example of how to Set-Alias for an old cmdline command. Thanks!!
by nohandle at 2012-11-08 03:22:34
Hi, thanks for useful info. I never thought about googling explorer parameters. :slight_smile:

aliasing command or cmdlet with parameters is not possible in powershell. but you can create a function and store it in your profile.
function Separate-Explorer
{
Explorer /separate
}
by DonJ at 2012-11-08 07:48:14
In v3, you can also set parameter defaults, although only to actual cmdlets, not to external commands. In this case, you’ve got the right idea.

Although, to conform with PowerShell standards, consider an approved, standard verb instead of "Separate." You can run Get-Verb to see the approved verbs.