Categories

A little bit of community

One thing I really like about the PowerShell community is the number of people who share information and the way that allows us to incrementally increase our knowledge and skills. This can lead to the situation where you can take ideas from two very separate people, from two different times and put them together to get something different.

I was reading my friend Jason’s blog post - http://powershell.org/wp/2014/03/23/new-tools-in-my-toolbox/ and when I got to the bit about using PowerShell to start Internet Explorer:

PS> Start iexplore www.bing.com

Start is an alias for Start-Process and I remembered something Ed Wilson (The Scripting Guy) once told me about using single letter aliases for his common activities.

Many people are aware of aliases within PowerShell and how they can cut down typing when you are working interactively. What isn’t so widely realised is that you can define aliases for non-PowerShell commands.

So in the interests of absolute brevity let define a new alias S that provides an even shorter way to use Start-Process:

New-Alias -Name S -Value Start-Process

You can test it by trying

s notepad

You should get an instance of notepad started.  This makes starting Internet Explorer as simple as:

s iexplore www.bing.com

Alternatively, you can cut out the use of Start-Process. Define an alias for Internet Explorer

New-Alias -Name I -Value 'C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE'

Try it using

i

And a new instance of IE will start

This means that you can start IE in a particular web site very quickly for example:

i www.bing.com
i amazon.co.uk

Single letter aliases are a great way to minimise your typing. If you want them to be always available then add them to your profile

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>