#SQLNewBlogger Week 3 – PowerShell Aliases

This is the 3rd of 4 posts for the #SQLNewBlogger challenge by Ed Leighton-Dick (@eleightondick / http://www.edleightondick.com)

My topic this week is aliases in powershell. Microsoft has attempted to make windows powershell familiar to anyone who has used the DOS command line (cmd.exe) or any version of the unix/linux shells. Many of the powershell commands have aliases built-in so the learning curve is not so steep.

From the powershell interactive prompt, simply type alias and a list of available aliases will scroll.

Properties are available for a single alias.

New-Alias or Set-Alias will create or change an alias so you can create and modify your own.

Multiple aliases for the same command are allowed. For example the powershell command Get-ChildItem has the aliases gci, dir and ls. All of these commands display the contents of a directory. If for some reason, you want foo to represent a directory listing, you can create it with the command

New-Alias foo Get-ChildItem

Note that this alias won’t persist if you close out of powershell, however, there are ways to set up your environment so it is available for new sessions.

Powershell is becoming more powerful and is integrated with most Microsoft products. In fact, there are a few places, where you can only use powershell to perform a task or configure a product (there is no GUI alternative). I encourage everyone to start learning powershell. With Microsoft making some of the commands familiar with aliases, there is no excuse for you not to look at what powershell can do for you.

I planning on writing more posts about powershell as I learn, but I wanted one of my 4 #SQLNewBlogger posts to be about a technology that I am personally excited about and can’t learn fast enough.

Advertisements

One thought on “#SQLNewBlogger Week 3 – PowerShell Aliases

  1. Pingback: SQL New Blogger Digest – Week 3 | The Rest is Just Code

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s