mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 16:03:22 +01:00
Updated open-URL.ps1 and open-help.ps1
This commit is contained in:
parent
12e55dca97
commit
b218b25be1
@ -5,6 +5,8 @@
|
|||||||
This PowerShell script launches a new tab in the default Web browser with the given URL.
|
This PowerShell script launches a new tab in the default Web browser with the given URL.
|
||||||
.PARAMETER URL
|
.PARAMETER URL
|
||||||
Specifies the URL
|
Specifies the URL
|
||||||
|
.PARAMETER text
|
||||||
|
Specifies the text to write to the console
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./open-URL.ps1 https://cnn.com
|
PS> ./open-URL.ps1 https://cnn.com
|
||||||
.LINK
|
.LINK
|
||||||
@ -13,11 +15,17 @@
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param([string]$URL = "")
|
param([string]$URL = "", [string]$text = "")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($URL -eq "") { $URL = Read-Host "Enter the URL" }
|
if ($URL -eq "") { $URL = Read-Host "Enter the URL" }
|
||||||
|
|
||||||
|
if ($text -ne "") {
|
||||||
|
Write-Host $text -noNewline
|
||||||
|
Write-Host $URL -foregroundColor blue
|
||||||
|
}
|
||||||
Start-Process $URL
|
Start-Process $URL
|
||||||
|
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
|
"⚠️ Error: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
|
||||||
|
@ -1,12 +1,32 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Provide help to the user
|
||||||
|
.DESCRIPTION
|
||||||
|
This PowerShell script launches new tabs in the Web browser with help pages.
|
||||||
|
.EXAMPLE
|
||||||
|
PS> ./open-help.ps1
|
||||||
|
.LINK
|
||||||
|
https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES
|
||||||
|
Author: Markus Fleschutz | License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
& "$PSScriptRoot/open-URL.ps1" "https://docs.microsoft.com/en-us/powershell"
|
""
|
||||||
Start-Sleep -milliseconds 100
|
& "$PSScriptRoot/write-typewriter.ps1" "OK - DON'T PANIC - HELP IS ON THE WAY..." 150
|
||||||
& "$PSScriptRoot/open-URL.ps1" "https://github.com/fleschutz/PowerShell/blob/main/docs/FAQ.md"
|
""
|
||||||
Start-Sleep -milliseconds 100
|
& "$PSScriptRoot/open-URL.ps1" -text "1. See the official PowerShell documentation at: " "https://docs.microsoft.com/en-us/powershell"
|
||||||
& "$PSScriptRoot/open-URL.ps1" "https://github.com/fleschutz/PowerShell/blob/main/docs/cheat-sheet.md"
|
Start-Sleep -milliseconds 50
|
||||||
|
|
||||||
& "$PSScriptRoot/write-typewriter.ps1" "DON'T PANIC and check the new brower tabs..."
|
& "$PSScriptRoot/open-URL.ps1" -text "2. A PowerShell tutorial is at: " "https://www.guru99.com/powershell-tutorial.html"
|
||||||
|
Start-Sleep -milliseconds 50
|
||||||
|
|
||||||
|
& "$PSScriptRoot/open-URL.ps1" -text "3. PowerShell FAQ's can be found here: " "https://github.com/fleschutz/PowerShell/blob/main/docs/FAQ.md"
|
||||||
|
Start-Sleep -milliseconds 50
|
||||||
|
|
||||||
|
& "$PSScriptRoot/open-URL.ps1" -text "4. A PowerShell Cheat Sheet is at: " "https://github.com/fleschutz/PowerShell/blob/main/docs/cheat-sheet.md"
|
||||||
|
""
|
||||||
|
"NOTE: Use <Ctrl> + <Click> to open the links in your browser."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user