PowerShell Scripts, Tips, Expert Advices, Forums, and Resources

Geek Sync Live

Welcome to PowerShell.com, the educational and community site for Windows PowerShell People. Get a quick overview.

Latest Forum Posts

06-29-2015 - "Input string was not in a correct format"...
06-23-2015 - Get-childitem exclude path
03-14-2015 - HOW TO HANDLE WINDOW?

As a Powershell.com member you will have access to:

  • Daily PowerShell tips written by Microsoft MVPs and other leading Windows PowerShell experts
  • Free Windows PowerShell advice and training provided by Microsoft MVPs and other leading Windows PowerShell experts
  • Access to leading Windows PowerShell blogs
  • A free ebook, Mastering PowerShell, written by Microsoft MVP Dr. Tobias Weltner
PowerTip of the Day

Open Web Page

To quickly open a new web page in the Internet Explorer, you could define a new function called Show-WebPage like this:

#requires -Version 2

function Show-WebPage
{
    param
    (
        [Parameter(Mandatory = $true, HelpMessage = 'URL to open')]
        $URL
    )

    Start-Process -FilePath iexplore.exe -ArgumentList $URL
} 

When you run this script and then enter Show-WebPage, the command asks you for a URL to open. You can also submit the URL as argument to Show-WebPage.

Note how the function uses Start-Process to launch the browser of your choice. If you changed the line to…

Start-Process -FilePath $URL

…then the URL would open in your default browser instead.

Twitter This Tip! ReTweet this Tip!

Copyright 2012 PowerShell.com. All rights reserved.