From a19489235a605d3a8fb5e954778a43cbe11e6be8 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Sun, 28 Apr 2024 17:19:57 +0200 Subject: [PATCH] Updated write-powershell-profile.ps1 --- scripts/write-powershell-profile.ps1 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/write-powershell-profile.ps1 b/scripts/write-powershell-profile.ps1 index eb0ea2ea..9cf56c79 100755 --- a/scripts/write-powershell-profile.ps1 +++ b/scripts/write-powershell-profile.ps1 @@ -7,10 +7,9 @@ Specifies the path to the new profile ($PSScriptRoot/my-profile.ps1 by default) .EXAMPLE PS> ./write-powershell-profile.ps1 - ⏳ (1/2) Querying path to profile 'CurrentUserCurrentHost'... - C:\Users\Markus\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 - ⏳ (2/2) Copying file 'my-profile.ps1'... - ✔️ New PowerShell profile written - it gets active on next login + ⏳ (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. .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -20,16 +19,15 @@ param([string]$path = "$PSScriptRoot/my-profile.ps1") try { - "⏳ (1/2) Querying path to profile 'CurrentUserCurrentHost'..." + "⏳ (1/2) Query location of PowerShell profile 'CurrentUserCurrentHost'..." $pathToProfile = $PROFILE.CurrentUserCurrentHost - " $pathToProfile" $filename = (Get-Item "$path").Name - "⏳ (2/2) Copying file '$filename'..." + "⏳ (2/2) Copy $filename to $pathToProfile..." $null = New-Item -Path $pathToProfile -ItemType "file" -Force Copy-Item "$path" "$pathToProfile" -force - "✔️ New PowerShell profile written - it gets active on next login" + "✔️ New PowerShell profile written - it get's active on next login." exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"