Monday, January 16, 2012

Alias and Powershell profiles


Hi All

I love “RUN” box.  We can open run box “Windows Key + R” and type the Excel, Powerpoint, and click on OK and its open these application which are in the System path.


But if you try to run “Excel” or “Powerpoint” etc in PowerShell console they wont work.


Everyday i open firefox, Internet Explorer, Ms Word, Ms Excel, Ms PowerPoint from “RUN” box. but today i thought that these application must me run from my powershell console.

The benefit of this is that i don't need to open “RUN” box every time before running any command.

Windows PowerShell Profile

First we need to create a windows powershell profile. It is a simple .ps1 file which reside on your Document folder and it run before opening PowerShell console.

Now open PowerShell Console and in Console type notepad $profile

If you don’t have profile created before it ask you to create a new file. Click on Yes.


First i want that whenever I open “PowerShell” console it should run in “D:\PowerShell”, to achieve this we need to use Set-Location cmdlet.

Set-location D:\PowerShell


Now save the file and close it. and lets open PowerShell Console again.

Cool!!! now the default path of PowerShell console is set to “D:\PowerShell”



Our Next Step is to setup alias. to achieve this we are using  Set-Alias .

The Syntax to setup alias is Set-Alias <Name> <Path of file >

We are setting up alias for Word,Excel,Powerpnt,Outlook,Firefox,Internet,Explorer,Chrome,

and the command should be : 

Note: I am using Office 2010 and may be your office path may be different.


Set-Alias word        'C:\Program Files\Microsoft Office\Office14\WINWORD.EXE'

Set-Alias powerpnt   'C:\Program Files\Microsoft Office\Office14\POWERPNT.EXE'

Set-Alias excel      'C:\Program Files\Microsoft Office\Office14\EXCEL.EXE'

Set-Alias outlook    'C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE'

Set-Alias firefox    'C:\Program Files\Mozilla Firefox\firefox.exe'

Set-Alias Iexplore   'C:\Program Files\Internet Explorer\iexplore.exe'

Set-Alias Chrome     'C:\Users\aman.dhally\AppData\Local\Google\Chrome\Application\chrome.exe'

now open our powershell profile again and paste the above command.


save the file and close it. and also close the PowerShell console and open it again.

Lets test it now

- Excel => Working


- Word => Working


- PowerPoint => Working


- Outlook => Working


Our all Ms Office applications are working .. lets test browsers now.

- Chrome => Working


- Firefox => Working


- Internet Explorer => Working


All is working .. u can add more alias if you want.


Aman Dhally

No comments:

Post a Comment