diff --git a/Microsoft.PowerShell_profile.ps1 b/Microsoft.PowerShell_profile.ps1 index da4512b..f09be65 100644 --- a/Microsoft.PowerShell_profile.ps1 +++ b/Microsoft.PowerShell_profile.ps1 @@ -298,7 +298,7 @@ if ($EDITOR_Override){ } # Quick Access to Editing the Profile function Edit-Profile { - vim $PROFILE.CurrentUserAllHosts + & $EDITOR $PROFILE.CurrentUserAllHosts } Set-Alias -Name ep -Value Edit-Profile @@ -337,11 +337,12 @@ function winutildev { # System Utilities function admin { + $cwd = (Get-Location).ProviderPath if ($args.Count -gt 0) { $argList = $args -join ' ' - Start-Process wt -Verb runAs -ArgumentList "pwsh.exe -NoExit -Command $argList" + Start-Process wt -Verb runAs -ArgumentList @('-d', $cwd, 'pwsh.exe', '-NoExit', '-Command', $argList) } else { - Start-Process wt -Verb runAs + Start-Process wt -Verb runAs -ArgumentList @('-d', $cwd, 'pwsh.exe', '-NoExit') } } @@ -755,7 +756,7 @@ Use '$($PSStyle.Foreground.Magenta)Show-Help$($PSStyle.Reset)' to display this h } if (Test-Path "$PSScriptRoot\CTTcustom.ps1") { - Invoke-Expression -Command "& `"$PSScriptRoot\CTTcustom.ps1`"" + . (Join-Path -Path $PSScriptRoot -ChildPath 'CTTcustom.ps1') } Write-Host "$($PSStyle.Foreground.Yellow)Use 'Show-Help' to display help$($PSStyle.Reset)" diff --git a/setup.ps1 b/setup.ps1 index 8e4546e..aa88b70 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -141,6 +141,8 @@ $themeInstalled = Install-OhMyPoshTheme -ThemeName "cobalt2" Install-NerdFonts -FontName "CascadiaCode" -FontDisplayName "CaskaydiaCove NF" # Final check and message to the user +[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") +$fontFamilies = (New-Object System.Drawing.Text.InstalledFontCollection).Families.Name if ((Test-Path -Path $PROFILE) -and (winget list --name "OhMyPosh" -e) -and ($fontFamilies -contains "CaskaydiaCove NF") -and $themeInstalled) { Write-Host "Setup completed successfully. Please restart your PowerShell session to apply changes." } else {