Windows Powershell 在 Windows 登录后第一次启动需要很长时间

Ase*_*sal 4 windows-7 powershell

我通常在 Windows 上使用 windows powershell 而不是命令提示符。我注意到,当我在 Windows 启动后第一次启动它时,需要很长时间才能显示命令提示。

为了解决这个问题,我启动它,然后立即关闭它,然后再次启动它。如果我这样做,它几乎立即开始。

有没有办法确保命令提示立即出现,而不是我必须做这个小技巧?

Ste*_*nny 6

PowerShell 依赖于 .NET Framework,您可以尝试更新它。另外,我注意到另一个答案中的脚本有几个问题

  • sort 将导致错误,因为并非所有条目都有 location
  • 某些系统将受益于 re ngening,而该脚本永远不会这样做

这是我修改后的版本

$Env:PATH = [Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()
[AppDomain]::CurrentDomain.GetAssemblies() | % {
  $pt = $_.Location
  if (! $pt) {continue}
  if ($cn++) {''}
  $na = Split-Path -Leaf $pt
  Write-Host -ForegroundColor Yellow "NGENing $na"
  ngen install $pt
}
Run Code Online (Sandbox Code Playgroud)