PowerShell Scripts to Open a Webpage

Let's start.

Let's say that you want to open a website of your choice when you start your computer browser, or you wish a specific process to start when you commit an action on a specific program. All that can be done using PowerShell scripts and the purpose of this article is to show how to do that.

Let's say you wish to open a webpage (or a specific URL) in your system's default browser, you can use that specific URL as an "executable" in the following PowerShell Script for that purpose.

The following shows how to open a browser with a default browser.

PowerShell Script

  1. Start-Process -FilePath www.c-sharpcorner.com  

Output

It will open the  preceding mentioned website (c-sharpcorner.com) on your default browser that is Mozilla Firefox here.

It is opening a webpage with a browser of your choice.

PowerShell Script

In this case you can specify the browser name of your choice, thereby specifying the URL.

Browser of choice: Google Chrome.

URL: www.c-sharpcorner.com

  1. Start-Process -FilePath Chrome -ArgumentList www.c-sharpcorner.com  

Output

The following  will open www.c-sharpcorner.com in Google Chrome.

 

Closure

In this article we had fun with PowerShell scripts. I hope you will like it.


Similar Articles