Added open-URL.ps1

This commit is contained in:
Markus Fleschutz
2024-05-29 18:13:34 +02:00
parent b3630a67c0
commit e447641434
2 changed files with 28 additions and 4 deletions

24
scripts/open-URL.ps1 Normal file
View File

@ -0,0 +1,24 @@
<#
.SYNOPSIS
Opens the default browser
.DESCRIPTION
This PowerShell script launches the default Web browser, optional with a given URL.
.PARAMETER URL
Specifies the URL
.EXAMPLE
PS> ./open-default-browser
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
param([string]$URL = "http://www.fleschutz.de")
try {
Start-Process $URL
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}