提高 PowerShell 启动速度

# Source - https://stackoverflow.com/a/59343705
# Posted by Theo
# Retrieved 2026-02-03, 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 启动速度
https://nekoside.com/archives/ti-gao-powershell-qi-dong-su-du
作者
nekoside
发布于
2026年02月03日
更新于
2026年02月03日
许可协议