Renamed to update-powershell-profile.ps1 and added a greeting to

my-profile.ps1
This commit is contained in:
Markus Fleschutz 2024-05-15 14:05:57 +02:00
parent 79376a98ff
commit 35d32e29e1
2 changed files with 11 additions and 8 deletions

View File

@ -1,11 +1,14 @@
# MY POWERSHELL PROFILE (this profile file defines the look & feel of PowerShell)
# MY POWERSHELL PROFILE (defines the look & feel of PowerShell)
# WINDOW TITLE
if ($IsLinux) { $Username = $(whoami) } else { $Username = $env:USERNAME }
$host.ui.RawUI.WindowTitle = "$Username @ $(hostname)"
# GREETING
Write-Host "Hi $USERNAME, what's up?" -foregroundColor green
# COMMAND PROMPT
function prompt { Write-Host -noNewline -foregroundColor yellow "`n"; return " " }
function prompt { Write-Host "`n" -noNewline -foregroundColor yellow; return " " }
# ALIAS NAMES
del alias:pwd -force -errorAction SilentlyContinue

View File

@ -1,15 +1,15 @@
<#
.SYNOPSIS
Writes the PowerShell profile
Updates the PowerShell profile
.DESCRIPTION
This PowerShell script writes the PowerShell profile for the current user.
This PowerShell script write/overwrites the PowerShell profile for the current user.
.PARAMETER path
Specifies the path to the new profile ($PSScriptRoot/my-profile.ps1 by default)
.EXAMPLE
PS> ./write-powershell-profile.ps1
PS> ./update-powershell-profile.ps1
(1/2) Query location of PowerShell profile 'CurrentUserCurrentHost'...
(2/2) Copy my-profile.ps1 to C:\Users\Markus\OneDrive\Dokumente\WindowsPowerShell\Microsoft.PowerShell_profile.ps1...
New PowerShell profile written - it get's active on next login.
(2/2) Copy my-profile.ps1 to C:\Users\Markus\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1...
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
"✔️ New PowerShell profile written - 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])"