Does it seem to anyone else that the Windows 7 command processor (CMD.EXE) is really slow starting up?
I ran this test from a command line (ntimer is a timing utility from the Windows server resource kit and you can just leave it out if you don't have it installed):
ntimer cmd /c for /l %a in (1,1,100) do @cmd /c rem
All it's doing is shelling out a new CMD.EXE 100 times. On my x64 Win7 base system that takes about 2.3 seconds to run. Running this is in an x86 Win7 virtual machine it takes about 5.6 seconds. Interestingly enough, in the VM using the old 16 bit command processor COMMAND.COM the same test takes less than 1 second.
Why so slow for CMD.EXE? I expected performance similar to what I saw with COMMAND.COM in the VM. The ratio of speeds for CMD.EXE between the raw machine and the VM seems reasonable, but the absolute speed is way slow. Anyone have any thoughts on this? Thanks!
I noticed this because I was doing a software build and the execution time went from 15 minutes in my old XP VM to 30 minutes in my new Win7 VM. The build process uses the GNUMAKE utility and does LOTS of shelling out to the command processor.
P.S. I asked this originally over on stackoverflow.com, but they suggested I go here.
instead of using cmd.com, have you tried PowerShell? I believe it's under accessories.
There seems to be a problem with installed keyboard layouts and cmd.exe (at least that's true for my vista machine and some of my colleagues).
Try to remove any additonal languages from "System Settings->Region and Language options->Keyboards & Languages->Change keyboards->Installed Services" (translated on the fly - YMMV).
That reduced cmd.exe startup for me from "very annoying" to "instant".
I suggest to use Sysinternals Process Explorer and Process Monitor to get an idea what is going on while it hangs. There are a lot of great tutorials for both programs and I highly recommend to get familiar with them.