Windows Powershell is taking long time to start the first time after Windows login

powershellwindows 7

I generally use windows powershell instead of command prompt on Windows. I have noticed that when I start it for the first time after Windows is started it takes a long time for the prompt for the commands to show up.

To take care of this problem I start it and then close it immediately and then start it again. If I do this it starts almost instantly.

Is there a way to make sure that the prompt for command comes up immediately instead of me having to do this little hack?

Best Answer

PowerShell relies on the .NET Framework, you can try updating that. Also, I noticed a couple of problems with the script in the other answer

  • sort is going to cause an error because not all entries have a location
  • some systems will benefit from rengening, which that script will never do

Here is my modified version

$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
}
Related Question