Error spawning 'cmd.exe'
When I compiled the project, there was an error,----Error spawning 'cmd.exe'.
Why ?
Answers
CMD.exe should have been found in your path.
I'm running into the same problem, but i've also found that system commands like ipconfig.exe won't run unless I'm in the system32 folder.
I'd say this is indicative of a bigger problem, potentially with path expansion.
I found that on my machine, the regvalue HKLM\SYSTEM\CurrentControlSet\control\Session Manager\environment\path was set as a REG_SZ instead of a REG_EXPAND_SZ, and my path included environment variables.
I suspect this occured when I installed NVideo Dev tools, as they were the last entry in my path string.
the solution is to create a new Expandable string called "PathX", copy the path value string into it, then delete the old path value and rename "PathX" to "Path" and reboot.
Fixed all my problems.
All Replies
- I am also getting this error constantly. Nothing in this forum (searching on this error) suggests an answer. Help!!
Hi all,
I've got the same problem and i've found this solution...
In the Options go into Projects and Solutions -> VC++ Directories page and place this rows:
$(SystemRoot)\System32
$(SystemRoot)
$(SystemRoot)\System32\wbemBye
- Proposed As Answer bystegosaurus1 Monday, April 20, 2009 2:27 AM
- The "SystemRoot" commands seemed to do it. No further problems yet with differing programs.
CMD.exe should have been found in your path.
I'm running into the same problem, but i've also found that system commands like ipconfig.exe won't run unless I'm in the system32 folder.
I'd say this is indicative of a bigger problem, potentially with path expansion.
I found that on my machine, the regvalue HKLM\SYSTEM\CurrentControlSet\control\Session Manager\environment\path was set as a REG_SZ instead of a REG_EXPAND_SZ, and my path included environment variables.
I suspect this occured when I installed NVideo Dev tools, as they were the last entry in my path string.
the solution is to create a new Expandable string called "PathX", copy the path value string into it, then delete the old path value and rename "PathX" to "Path" and reboot.
Fixed all my problems.
- Im getting the same problem, i tried using the
$(SystemRoot)\System32
$(SystemRoot)
$(SystemRoot)\System32\wbem
it didtn work for me :( any suggestions?
- Proposed As Answer byAyyavu P Monday, October 05, 2009 11:29 AM
- Try using the solution I posted previously
- The fix from Jaeger worked for me. No restart was required though.
- I tried Jaeger Mitchell's method of fixing, with no luck. Any ideas out there folks?
- Thank you MagicPN, your "trick" worked for me either

- I'm getting this same problem too.
Because I have the Professional version of VS 2005, maybe this is not the right forum to post, but my problem is that I can't find the following:
Projects and Solutions -> VC++ Directories page
This option is only in the express version?
Projects and Solutions are there, but not the directories area.
Is there somewhere else that I can enter this data?
Or is there another solution to getting past this error? -- It seems to happen at the end of the build when it tries to embed the manifest information.
Thanks
Same here ... Maby this help ... earlier I hadnt probs and it happening after installed sdk 1 - needed for some apps.For Visual Studio 2008, it's tools->option->Project and Soltuions->VC++ Directories
- Thanks !!! The solution given by MagicPIN worked for me !!
- This solution did not work for me I am still getting this error out of both 2008 express and the 2005 studio. Any alternative or further discussion?
- ThrasherNYC's soggestions works on VS 2008 !
- I encountered this problem after installing Studio Plug Ins for xUnit and NUnit and searched for several hours to find the real answer. In my case the Registry setting type was changed in the Studio's path environment. Open the Studio Command Window and try to use cmd, then try cmd in the new window and it will fail. This confirms the path is hosed in the Studio environment.
I copied this from another post somewhere:
...a bigger problem, potentially with path expansion.I found that on my machine, the regvalue HKLM\SYSTEM\CurrentControlSet\control\Session Manager\environment\path was set as a REG_SZ instead of a REG_EXPAND_SZ, and my path included environment variables.
I suspect this occured when I installed NVideo Dev tools, as they were the last entry in my path string.
The solution is to create a new Reg Entry Expandable string called "PathX", copy the "Path" value string into it, then delete the old path value and rename "PathX" to "Path" and reboot.Fixed all my problems.
Fixed my problems too. Thanks man..
The solution works..
- Thanks. It worked for me!!
- Thanks MagicPN. I just used a text editor on 'VCComponents.dat' and added the files to the 'Path Dirs' line.
Worked ok!
I am new to this discussion...
I got similar problem...
Thnks....MagicPN and others.
adding the paths......
$(SystemRoot)\System32
$(SystemRoot)
$(SystemRoot)\System32\wbem
it worked for me.
Vasu
- Thank You very much Jaeger Mitchell ...it s working after made registry changes.
Im getting the same problem, i tried using the
$(SystemRoot)\System32
$(SystemRoot)
$(SystemRoot)\System32\wbem
it didtn work for me :( any suggestions?
Thank you. MagicPN
Awesome!!!- This worked for me. Follow this link: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=98658
Workaround: Placing a physical copy of cmd.exe in the VC\Bin directory appears to resolve this problem.
1. Copy cmd.exe from C:\WINDOWS\System32\cmd.exe
2. Paste at C:\Program Files\Microsoft Visual Studio 8\VC\bin, or the appropriate installation folder on your system.- Proposed As Answer byMMAli Monday, October 05, 2009 3:31 PM
- MagicPN, Jaeger, MMAli's solutions are all working. I got that error because I have changed the Path var for Java.

