PowerShell/docs/my-profile.md

42 lines
1.3 KiB
Markdown
Raw Normal View History

2024-01-25 13:37:12 +01:00
Script: *my-profile.ps1*
========================
2022-11-17 20:02:26 +01:00
my-profile.ps1
2021-10-17 14:33:27 +02:00
2023-07-29 10:04:38 +02:00
Parameters
----------
2021-10-17 14:33:27 +02:00
```powershell
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
2023-07-29 10:04:38 +02:00
Script Content
--------------
2022-11-17 20:05:34 +01:00
```powershell
2024-05-19 10:25:56 +02:00
# MY POWERSHELL PROFILE (defines the look & feel of PowerShell)
2022-11-17 20:02:26 +01:00
# WINDOW TITLE
2024-08-15 09:51:46 +02:00
if ($IsLinux) { $username = $(whoami) } else { $username = $env:USERNAME }
$host.ui.RawUI.WindowTitle = "$username @ $(hostname)"
2022-11-17 20:02:26 +01:00
2024-05-19 10:25:56 +02:00
# GREETING
2024-08-15 09:51:46 +02:00
Write-Host "👋 Welcome $username to $(hostname)'s PowerShell - type 'hlp' for help." -foregroundColor green
2024-05-19 10:25:56 +02:00
2022-11-17 20:02:26 +01:00
# COMMAND PROMPT
2024-05-19 10:25:56 +02:00
function prompt { Write-Host "`n➤ " -noNewline -foregroundColor yellow; return " " }
2022-11-17 20:02:26 +01:00
# ALIAS NAMES
del alias:pwd -force -errorAction SilentlyContinue
2024-08-15 09:51:46 +02:00
set-alias -name hlp -value open-help.ps1
2022-11-17 20:02:26 +01:00
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
set-alias -name ls -value list-folder.ps1 # ls = list folder (short format)
2022-11-17 20:05:34 +01:00
```
2022-11-17 20:02:26 +01:00
2024-08-15 09:51:46 +02:00
*(generated by convert-ps2md.ps1 using the comment-based help of my-profile.ps1 as of 08/15/2024 09:50:51)*