Sunday, July 22, 2018

Use PowerShell to launch Internet Explorer

Want to save some time? With PowerShell, we can use Start-Process to launch Internet Explorer:

Start-Process iexplore www.google.com

 


We can speed that up with an alias, substituting 's' for Start-Process:

New-Alias -Name s -Value Start-Process

 


We can test the alias with notepad:

s notepad

And  a blank notepad should open right up.

Now we should be able to launch Internet Explorer more quickly using our alias:

s iexplore https://en.wikipedia.org

 


Even better, we can create an alias for Internet Explorer itself. Let's call it 'ie':

New-Alias -Name ie -Value "C:\Program Files\Internet Explorer\iexplore.exe"

(Your system's path to the executable may vary.)

We can test the alias:

ie

and a new instance of Internet Explorer should launch.

If we put those aliases into our PowerShell profile, they'll always be available.

Note: aliases are a good time-saver for our own interactive sessions with PowerShell, but they are not recommended for use in scripts, since the aliases make it harder for others to know what the scripts are doing.

No comments:

Post a Comment