diff --git a/PowerShell/Microsoft.PowerShell_profile.ps1 b/PowerShell/Microsoft.PowerShell_profile.ps1 index 770ad09..3ee577c 100644 --- a/PowerShell/Microsoft.PowerShell_profile.ps1 +++ b/PowerShell/Microsoft.PowerShell_profile.ps1 @@ -45,7 +45,17 @@ if ($IsWindows) { # Windows 下的 vcpkg 初始化 Import-Module 'V:\githubs\vcpkg\scripts\posh-vcpkg' - + + # Windows 10 only + $is_windows_10 = [System.Environment]::OSVersion.Version.Major -eq "10" + if ($is_windows_10) { + # https://github.com/PowerShell/PowerShell/issues/13138 + # 其实就是 patch 成 import-module appx -usewindowspowershell + $PSDefaultParameterValues['Import-Module:UseWindowsPowerShell'] = { + if ((Get-PSCallStack)[1].Position.Text -match '\bAppX\b') { $true } + } + Write-Host "loaded Windows 10 only profile" + } Write-Host "loaded Windows only profile" }