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$_"}
}
}