powershell的確要比cmd好,可是啓動速度太慢。。。。
最近從MSDN上看到一篇文章,原地址鏈接如下:
大意就是:
用管理員權限打開powershell,然後將如下代碼粘貼進去,然後兩次回車後(確切的說,換行後再追加一個回車),便執行如下代碼:
Set-Alias ngen (Join-Path ([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()) ngen.exe)
[AppDomain]::CurrentDomain.GetAssemblies() |
sort {Split-path $_.location -leaf} |
%{
$Name = (Split-Path $_.location -leaf)
if ([System.Runtime.InteropServices.RuntimeEnvironment]::FromGlobalAccessCache($_))
{
Write-Host "Already GACed: $Name"
}else
{
Write-Host -ForegroundColor Yellow "NGENing : $Name"
ngen $_.location | %{"`t$_"}
}
}