Opening Webpages from PowerShell

by Mar 16, 2015

All versions

Let’s assume you would like to open your favorite websites in a browser when you start your day. PowerShell can do this for you easily. It depends a bit how you would like the pages to open, though.

When you use Start-Process, you can specify the browser of your choice, and submit the URL as argument:

# starts with a specific browser
Start-Process -FilePath iexplore -ArgumentList www.powershellmagazine.com

This would open the website in Internet Explorer, regardless of default browser settings.

However, it would also always open a new browser instance. Take a look at this approach:

# starts with default browser and adds to open browser
Start-Process -FilePath www.tagesschau.de

Here, you provide the URL as “executable”, so Windows will use the default browser, and if the default browser is open already, it will just add more tabs to it, rather than opening new browser windows.

To have PowerShell open webpages automatically on launch, make sure the path in $profile exists. Next, open this script, and add your startup commands.

Twitter This Tip! ReTweet this Tip!