locked
Error spawning 'cmd.exe'

    Question

  •   When I compiled the project, there was an error,----Error spawning 'cmd.exe'.

      Why ?

    Sunday, December 18, 2005 6:08 AM

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.

    Thursday, January 26, 2006 9:19 PM

All replies

  • I am also getting this error constantly.  Nothing in this forum (searching on this error) suggests an answer.  Help!!
    Saturday, January 7, 2006 3:35 PM
  • 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\wbem

    Bye

    • Proposed as answer by stegosaurus1 Monday, April 20, 2009 2:27 AM
    Sunday, January 8, 2006 1:30 PM
  • The "SystemRoot" commands seemed to do it.  No further problems yet with differing programs.
    Tuesday, January 10, 2006 12:09 PM
  • 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.

    Thursday, January 26, 2006 9:19 PM
  • 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 by Ayyavu P Monday, October 5, 2009 11:29 AM
    Wednesday, August 2, 2006 4:48 PM
  • Try using the solution I posted previously
    Wednesday, August 2, 2006 8:45 PM
  • The fix from Jaeger worked for me. No restart was required though.
    Tuesday, October 24, 2006 10:31 AM
  • I tried Jaeger Mitchell's method of fixing, with no luck. Any ideas out there folks? 
    Tuesday, November 14, 2006 4:40 PM
  • Thank you MagicPN, your "trick" worked for me either
    Monday, April 30, 2007 3:38 PM
  • 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
    Tuesday, August 28, 2007 9:08 PM
  •  

    Same here ... Maby this help ... earlier I hadnt probs and it happening after installed sdk 1 - needed for some apps.
    Saturday, December 22, 2007 6:27 AM
  • For Visual Studio 2008, it's tools->option->Project and Soltuions->VC++ Directories

    Saturday, December 22, 2007 5:36 PM
  • Thanks !!! The solution given by MagicPIN worked for me !!
    Thursday, January 24, 2008 12:59 AM
  • 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?
    Sunday, March 30, 2008 9:27 PM
  • ThrasherNYC's soggestions works on VS 2008 !
    Thursday, April 10, 2008 8:45 AM
  • 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.
    Wednesday, July 23, 2008 3:26 PM
  • Thanks man..

    The solution works..

    Wednesday, October 8, 2008 8:01 PM
  • Thanks. It worked for me!!
    Wednesday, November 5, 2008 2:40 AM
  • Thanks MagicPN. I just used a text editor on 'VCComponents.dat' and added the files to the 'Path Dirs' line.

    Worked ok!
    Monday, April 20, 2009 2:28 AM

  • 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
    Tuesday, June 23, 2009 4:30 AM
  • Thank You very much Jaeger Mitchell ...it s working after made registry changes.
    Friday, August 7, 2009 5:04 AM
  • 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!!!
    • Proposed as answer by FugersonHall Monday, November 14, 2011 5:02 PM
    Tuesday, September 8, 2009 3:33 AM
  • 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 by MMAli Monday, October 5, 2009 3:31 PM
    Monday, October 5, 2009 3:30 PM
  • MagicPN, Jaeger, MMAli's solutions are all working. I got that error because I have changed the Path var for Java.
    Sunday, October 25, 2009 2:56 AM
  • This solution Worked perfectly for me.
    Thanks!!!!
    Wednesday, January 13, 2010 10:03 AM
  • In the Options go into Projects and Solutions -> VC++ Directories page and place this rows:

    $(SystemRoot)\System32
    $(SystemRoot)
    $(SystemRoot)\System32\wbem



    it works for me..

    thanks
    Saturday, January 16, 2010 9:59 AM
  • 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\wbem

    Bye


    Brilliant suggestion !!!!
    Thanks a Tonn !!
    Friday, February 12, 2010 11:13 AM
  • thank you! it really worked!
    Sunday, March 21, 2010 6:01 AM
  • Thanks Magic,

     It resolved my issue.

    Sanat

    Friday, April 30, 2010 11:59 AM
  • Hello,

    This is worked.

    Thanks.

    :D

    Sunday, May 30, 2010 7:00 AM
  • It worked for me..

    Thanks a lot :-)

    Monday, August 9, 2010 12:49 PM
  • 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\wbem

    Bye


    Thanks! I still wonder why though I already got it solved.
    Thursday, September 23, 2010 1:34 AM
  • Thanx Magic PN ..... it worked......:)
    Sunday, September 26, 2010 2:53 AM
  • I had the "Error spawning 'cmd.exe'" error too but thanks to MagicPN for his solution.  The project now builds successfully.

    Paul

    Wednesday, October 13, 2010 4:27 PM
  • Thanx a lot Magic PN. I had the same problem and ur solution worked for me.
    Thursday, November 18, 2010 5:46 AM
  • Hey thx for showing us where to find the VC++ Directories. I have VS2008, and I can't find the Project and solution on tools->Option... What can I do ?
    Monday, December 20, 2010 7:36 PM
  • hey u r really magi..my project was just stopped because of this error...thanks alot...
    Saturday, February 26, 2011 5:31 PM
  • thats done it. many thanks

    Chris

    Monday, May 23, 2011 7:04 PM
  • 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\wbem

    Bye

    This solution worked for me (after changing the registry entry suggested by Jaeger Mitchell, may fix other problems), but I was only able to modify the VC++ Directories page in VS 2008, since it is now deprecated in VS 2010. Since VS 2008 is now happily building the Phoenix Viewer (for Second Life) I am content to work with that version of VS. I wonder if there is a registry entry I can tweak to make sure I can build using VS 2010 as well.
    Saturday, September 24, 2011 4:18 AM