Reputation: 14011
I have created a simple vc++ console application and try to print "Hello World". I am using Windows Server 2003 machine.
When I try to build this project I got the error as Error: spawning cmd.exe
How do I fix this?
Upvotes: 5
Views: 12673
Reputation: 424
It was giving error for me because cmd.exe was not accessible with the current user. What I did to solve this problem :
- Close current Visual Studio.
- Reopen Visual Studio by right clicking on visual studio and select 'Run as administrator'
- Now run The project.
Why It works
To access cmd.exe application must have privilege to run this. It doesn't have permission to access this and hence it works next time when you tries to access it normally(without running application as Administrator)
Operating System Windows 7
Upvotes: 0
Reputation: 6518
If you get error like this
Just open Tools –> Options –> Projects and Solutions –> VC++ Directories
and add these lines :
$(SystemRoot)\System32
$(SystemRoot)
$(SystemRoot)\System32\wbem
Upvotes: 3
Reputation: 10483
Yep. (Another weird windows error) Projects and Solutions -> VC++ Directories -> Executable Files Add $(SystemRoot)\System32 it works
Upvotes: 0
Reputation: 14011
yes i hav found where the proble. I unable to locate path of cmd.exe so go to visualstudio tools->options->projects and ->vc++ directories and specify ($SystemRoot)/system32 then it working fine.
Upvotes: 1
Reputation: 35450
Check if cmd.exe is in <Path>
environment variable?
I just did a small test by removing the %SystemRoot%\system32
from path
environment variable and I got the same problem what you are facing.
Error 4 Error spawning 'cmd.exe'. Project SEH
If it is the path issue then try adding below to Projects and Solutions -> VC++ Directories
:
$(SystemRoot)\System32
Upvotes: 16
Reputation: 3504
I believe cmd.exe is not runnable by a non administrative user by default on Windows Server 2003, so I would check its permissions. That of course assumes you are not running it as Administrator already.
Upvotes: 0
Reputation: 1885
Are you running on Vista? Could this be a case of needing to run Visual Studio as Administrator?
Upvotes: 0