PowerShell/Scripts/my-profile.ps1

35 lines
952 B
PowerShell
Raw Normal View History

2021-04-03 15:24:18 +02:00
# My PowerShell Profile
# =====================
# Welcome to 'my-profile.ps1' - this file defines the look & feel of PowerShell.
# Comment, uncomment or adapt the following lines to your needs, please.
# My Welcome Message
# ------------------
write-host "+++ Welcome to PowerShell $($PSVersionTable.PSVersion) at $(hostname), it's $(Get-date) +++"
write-host ""
2021-04-03 15:24:18 +02:00
# My Command Prompt
# -----------------
2021-02-27 11:19:57 +01:00
2021-04-03 15:24:18 +02:00
# function prompt {$null} # result is: PS>
2021-02-25 11:57:02 +01:00
2021-04-03 15:24:18 +02:00
# function prompt { "$ " } # result is: $
2021-02-25 11:57:02 +01:00
2021-03-15 16:21:59 +01:00
function prompt {
if ($IsLinux) { $User = $(whoami) } else { $User = $env:USERNAME }
$host.ui.RawUI.WindowTitle = "$User @ $(hostname)"
2021-03-15 16:21:59 +01:00
write-host -foregroundColor blue -noNewLine "$(Get-Location)"
return "> "
2021-04-03 15:24:18 +02:00
} # result is: C:\>
2021-02-27 11:19:57 +01:00
2021-04-03 15:24:18 +02:00
# My Alias Names (sorted alphabetically)
2021-04-03 15:24:18 +02:00
# --------------
set-alias -name ll -value get-childitem # ll = list long
set-alias -name lsf -value list-formatted.ps1 # lsf = list directory formatted in columns
2021-04-03 15:46:30 +02:00