提高 PowerShell 启动速度
在提权的 powershell 中执行以下代码:
# Source - https://stackoverflow.com/a/59343705
# Posted by Theo
# Retrieved 2026-06-19, License - CC BY-SA 4.0
$env:PATH = [Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()
[AppDomain]::CurrentDomain.GetAssemblies() | ForEach-Object {
$path = $_.Location
if ($path) {
$name = Split-Path $path -Leaf
Write-Host -ForegroundColor Yellow "`r`nRunning ngen.exe on '$name'"
ngen.exe install $path /nologo
}
}
提高 PowerShell 启动速度
/archives/improve-pwsh-startspeed