mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 21:07:40 +02:00
Updated open-URL.ps1 and open-help.ps1
This commit is contained in:
@ -5,6 +5,8 @@
|
||||
This PowerShell script launches a new tab in the default Web browser with the given URL.
|
||||
.PARAMETER URL
|
||||
Specifies the URL
|
||||
.PARAMETER text
|
||||
Specifies the text to write to the console
|
||||
.EXAMPLE
|
||||
PS> ./open-URL.ps1 https://cnn.com
|
||||
.LINK
|
||||
@ -13,11 +15,17 @@
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([string]$URL = "")
|
||||
param([string]$URL = "", [string]$text = "")
|
||||
|
||||
try {
|
||||
if ($URL -eq "") { $URL = Read-Host "Enter the URL" }
|
||||
|
||||
if ($text -ne "") {
|
||||
Write-Host $text -noNewline
|
||||
Write-Host $URL -foregroundColor blue
|
||||
}
|
||||
Start-Process $URL
|
||||
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
|
||||
|
Reference in New Issue
Block a user