mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-12 00:48:17 +01:00
Renamed to update-powershell-profile.ps1 and added a greeting to
my-profile.ps1
This commit is contained in:
parent
79376a98ff
commit
35d32e29e1
@ -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
|
# WINDOW TITLE
|
||||||
if ($IsLinux) { $Username = $(whoami) } else { $Username = $env:USERNAME }
|
if ($IsLinux) { $Username = $(whoami) } else { $Username = $env:USERNAME }
|
||||||
$host.ui.RawUI.WindowTitle = "$Username @ $(hostname)"
|
$host.ui.RawUI.WindowTitle = "$Username @ $(hostname)"
|
||||||
|
|
||||||
|
# GREETING
|
||||||
|
Write-Host "Hi $USERNAME, what's up?" -foregroundColor green
|
||||||
|
|
||||||
# COMMAND PROMPT
|
# COMMAND PROMPT
|
||||||
function prompt { Write-Host -noNewline -foregroundColor yellow "`n➤ "; return " " }
|
function prompt { Write-Host "`n➤ " -noNewline -foregroundColor yellow; return " " }
|
||||||
|
|
||||||
# ALIAS NAMES
|
# ALIAS NAMES
|
||||||
del alias:pwd -force -errorAction SilentlyContinue
|
del alias:pwd -force -errorAction SilentlyContinue
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Writes the PowerShell profile
|
Updates the PowerShell profile
|
||||||
.DESCRIPTION
|
.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
|
.PARAMETER path
|
||||||
Specifies the path to the new profile ($PSScriptRoot/my-profile.ps1 by default)
|
Specifies the path to the new profile ($PSScriptRoot/my-profile.ps1 by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./write-powershell-profile.ps1
|
PS> ./update-powershell-profile.ps1
|
||||||
⏳ (1/2) Query location of PowerShell profile 'CurrentUserCurrentHost'...
|
⏳ (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...
|
⏳ (2/2) Copy my-profile.ps1 to C:\Users\Markus\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1...
|
||||||
✔️ New PowerShell profile written - it get's active on next login.
|
✔️ PowerShell profile updated - it get's active on next login.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -27,7 +27,7 @@ try {
|
|||||||
$null = New-Item -Path $pathToProfile -ItemType "file" -Force
|
$null = New-Item -Path $pathToProfile -ItemType "file" -Force
|
||||||
Copy-Item "$path" "$pathToProfile" -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
|
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