Added open-help.ps1

This commit is contained in:
Markus Fleschutz 2024-05-29 17:07:27 +02:00
parent 9695724b4d
commit f5e3c66dc3
3 changed files with 18 additions and 3 deletions

View File

@ -5,13 +5,14 @@ if ($IsLinux) { $username = $(whoami) } else { $username = $env:USERNAME }
$host.ui.RawUI.WindowTitle = "$username @ $(hostname)"
# GREETING
Write-Host "👋 Welcome $username to PowerShell at $(hostname)." -foregroundColor green
Write-Host "👋 Welcome $username to $(hostname)'s PowerShell - type 'hlp' for help." -foregroundColor green
# COMMAND PROMPT
function prompt { Write-Host "`n" -noNewline -foregroundColor yellow; return " " }
# ALIAS NAMES
del alias:pwd -force -errorAction SilentlyContinue
set-alias -name hlp -value open-help.ps1
set-alias -name pwd -value list-workdir.ps1 # pwd = print working directory
set-alias -name ll -value get-childitem # ll = list folder (long format)
del alias:ls -force -errorAction SilentlyContinue

14
scripts/open-help.ps1 Normal file
View File

@ -0,0 +1,14 @@
try {
& "$PSScriptRoot/open-default-browser.ps1" "https://docs.microsoft.com/en-us/powershell"
Start-Sleep -milliseconds 100
& "$PSScriptRoot/open-default-browser.ps1" "https://github.com/fleschutz/PowerShell/blob/main/docs/FAQ.md"
Start-Sleep -milliseconds 100
& "$PSScriptRoot/open-default-browser.ps1" "https://github.com/fleschutz/PowerShell/blob/main/docs/cheat-sheet.md"
& "$PSScriptRoot/write-typewriter.ps1" "DON'T PANIC and check your brower tabs..."
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -9,7 +9,7 @@
PS> ./update-powershell-profile.ps1
(1/2) Query path to PowerShell profile 'CurrentUserCurrentHost'...
(2/2) Copy my-profile.ps1 to C:\Users\Markus\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1...
Updated your PowerShell profile - it get's active on next login.
PowerShell profile updated - it get's active on next login.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -27,7 +27,7 @@ try {
$null = New-Item -Path $pathToProfile -ItemType "file" -Force
Copy-Item "$path" "$pathToProfile" -force
"✔️ Updated your PowerShell profile - it get's active on next login."
"✔️ PowerShell profile updated - it get's active on next login."
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"