Update set-profile.ps1

This commit is contained in:
Markus Fleschutz 2023-04-01 21:47:02 +02:00
parent 43a92a1432
commit 21675577c1

View File

@ -12,18 +12,18 @@
#> #>
try { try {
"Step 1/3 - Querying path to PowerShell profile 'CurrentUserCurrentHost'..." "(1/3) Querying path to PowerShell profile 'CurrentUserCurrentHost'..."
$PathToProfile = $PROFILE.CurrentUserCurrentHost $PathToProfile = $PROFILE.CurrentUserCurrentHost
"$PathToProfile" "$PathToProfile"
"Step 2/3 - Creating the profile (if non-existent)..." "(2/3) Creating the profile (if non-existent)..."
$Null = New-Item -Path $profile -ItemType "file" -Force $Null = New-Item -Path $profile -ItemType "file" -Force
"Step 3/3 - Copying my-profile.ps1..." "(3/3) Copying my-profile.ps1..."
$PathToRepo = "$PSScriptRoot/.." $PathToRepo = "$PSScriptRoot/.."
Copy-Item "$PathToRepo/Scripts/my-profile.ps1" "$PathToProfile" -force Copy-Item "$PathToRepo/Scripts/my-profile.ps1" "$PathToProfile" -force
"✔️ updated PowerShell profile by my-profile.ps1 - it gets active on next login" "✔️ updated your PowerShell profile by my-profile.ps1 - it gets 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])"