Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I run CMD.exe, it fires up almost instantaneously. Running PowerShell.exe does not provide quite the same experience. Wait times for startup of PowerShell can range from just a few, to several seconds or more.

Why are these so different? Is there anything that can be done to optimize PowerShell's startup time?

share|improve this question

closed as not constructive by Ƭᴇcʜιᴇ007, Indrek, 8088, Mokubai, KronoS Sep 9 '12 at 18:00

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Powershell loads plenty fast on my system (<1 second). Have you got any modules or snap-ins installed in PS? Do you find this on multiple computers or just one? Have you ensured your system has no other problems (disk checks, etc.)? –  Ƭᴇcʜιᴇ007 Sep 5 '12 at 16:00
1  
I've experienced this with every system I've used PowerShell on. Most times it's about a second delay or less, but sometimes it is longer. I haven't put it to a stopwatch yet though, this is just how it feels. In any case, it's still noticeably slower to load than CMD. –  Iszi Sep 5 '12 at 16:04
    
After loading both on my system, cmd had a working set of 2400K whereas PowerShell had a working set of 35964K. There was no noticeable difference in start up time on an i5 with 7200rpm disk. If PowerShell is used infrequently, Windows may not be prefetching it. PowerShell ISE is twice the size and, because I don't use it very often, takes a while to start the first time. –  David Marshall Sep 5 '12 at 16:28
    
Also keep in mind that PowerShell has to load the .NET framework because it is fundamentally able to invoke arbitrary CLR code, so it isn't just a simple "native" command interpreter; it's basically a scripting environment for .NET. –  ÃŁŁǫǛȉЖΦΤїҪ Sep 7 '12 at 13:40
    
This is why I hate the PowerShell and keep using the command-prompt (well, the slowness and the unpleasantness of the syntax and general unfriendliness). –  Synetech Sep 20 '12 at 5:11

1 Answer 1

Aside from hardware upgrades that may make I/O or processing faster, there is very little that you, as a user, can legally do to modify a closed-source program on a closed-source operating system to "make it faster". There are of course plenty of "generic" tricks that improve performance across the board, but these don't directly target PowerShell. For example:

  • Disabling active virus scanner or using a faster one
  • Defragging your HDD or using a custom defragging tool
  • Using an SSD to reduce access times, a Hardware RAID controller to increase bandwidth, or a combination of the two
  • Using faster RAM to reduce memory latency and improve throughput
  • Using a newer hardware platform (e.g. Ivy Bridge) for across-the-board performance improvements and the elimination of bottlenecks
  • Reinstalling the OS or running various "cleaner" programs (can be dangerous) to clear out accruing junk like unneeded registry values, temporary files, SxS configurations, unneeded runtimes from VS2003/2005, programs that launch on startup, etc.

All of these are sort of "side-channel attacks" on the general problem of having slow-running programs that are beyond your control to directly modify or improve.

The only things I can think of that may in any way impact PowerShell startup performance directly are:

  • The quantity and size of your environment variables. You can change your environment variables in System under Advanced Settings.
  • Scripts that are wired up to launch on startup of PowerShell. If you don't know for a fact that you don't have these, you may indeed have them, and they can obviously impact startup time.

Either one of these things may be the answer to your question, but if not, I am not aware of any other factors that can influence PowerShell startup performance aside from the generic side-channel performance-impacting factors that I listed above.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.