Error PRJ0002 : Error result 1 returned from 'C:\WINDOWS\system32\cmd.exe'
I keep getting the following error message every time I try to run or build a C++ application in Visual Studio 2005:
Project : error PRJ0002 : Error result 1 returned from 'C:\WINDOWS\system32\cmd.exe'.
It only comes up with a C++ program. VB seems to be fine.
I was working on a "Class Library" when it first started so I tried creating a new project. I tried doing a build before doing anything and the error message still came up.
Then I tried creating a brand new "Windows Form Application" and running it without any modifications - same error.
I tried uninstalling and then reinstalling Visual Studio 2005 - same problem.
What do I need to do to get rid of this problem?
Build Log Rebuild started: Project: Test3, Configuration: Debug|Win32
Command Lines Creating temporary file "c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\Debug\RSP00000C39403432.rsp" with contents [ /Od /D "WIN32" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /FD /EHa /MDd /Yu"stdafx.h" /Fp"Debug\Test3.pch" /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /c /Zi /clr:pure /TP /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.XML.dll" ".\Test3.cpp" ".\AssemblyInfo.cpp" ] Creating command line "cl.exe @"c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\Debug\RSP00000C39403432.rsp" /nologo /errorReport:prompt" Creating temporary file "c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\Debug\RSP00000D39403432.rsp" with contents [ /Od /D "WIN32" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /FD /EHa /MDd /Yc"stdafx.h" /Fp"Debug\Test3.pch" /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /c /Zi /clr:pure /TP /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll" /FU "c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.XML.dll" ".\stdafx.cpp" ] Creating command line "cl.exe @"c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\Debug\RSP00000D39403432.rsp" /nologo /errorReport:prompt" Creating command line "resgen.exe /useSourcePath /compile "c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\frmMain.resX","Debug\Test3.frmMain.resources"" Creating command line "rc.exe /d "_UNICODE" /d "UNICODE" /fo"Debug/app.res" ".\app.rc"" Creating temporary file "c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\Debug\RSP00000E39403432.rsp" with contents [ /OUT:"C:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\Debug\Test3.exe" /INCREMENTAL /MANIFEST /MANIFESTFILE:"Debug\Test3.exe.intermediate.manifest" /DEBUG /ASSEMBLYDEBUG /PDB:"c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\Debug\Test3.pdb" /SUBSYSTEM:WINDOWS /ENTRY:"main" /MACHINE:X86 /FIXED:No /ASSEMBLYRESOURCE:".\Debug\Test3.frmMain.resources" ".\Debug\AssemblyInfo.obj" ".\Debug\stdafx.obj" ".\Debug\Test3.obj" ".\Debug\app.res" ] Creating command line "link.exe @"c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\Debug\RSP00000E39403432.rsp" /NOLOGO /ERRORREPORT:PROMPT" Creating temporary file "c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\Debug\RSP00000F39403432.rsp" with contents [ /outputresource:".\Debug\Test3.exe;#1" /manifest ".\Debug\Test3.exe.intermediate.manifest" ] Creating command line "mt.exe @"c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\Debug\RSP00000F39403432.rsp" /nologo" Creating temporary file "c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\Debug\BAT00001039403432.bat" with contents [ @echo Manifest resource last updated at %TIME% on %DATE% > ".\Debug\mt.dep" ] Creating command line """c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\Debug\BAT00001039403432.bat"""
Output Window Compiling... stdafx.cpp Compiling... Test3.cpp AssemblyInfo.cpp Generating Code... Compiling managed resources... Read in 0 resources from "c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\frmMain.resX" Writing resource file... Done. Compiling resources... Linking... Embedding manifest... Project : error PRJ0002 : Error result 1 returned from 'C:\WINDOWS\system32\cmd.exe'.
Results Build log was saved at "file://c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\Debug\BuildLog.htm" Test3 - 1 error(s), 0 warning(s)
Answers
Thats certainly fairly odd.
Looking at the build log, everything is fine up until at least the building of the manifest.
My guess is that it has completed the "Embedding Manifest..." part because the exe it is actially running is mt.exe not cmd.exe.
The last command is the one that is running in a command... maybe.
Try going to c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\ in a command window and running the command line:
@echo Manifest resource last updated at %TIME% on %DATE% > ".\Debug\mt.dep"
Which is what its actually trying to run. If that doesn't work then you have your culprit.
It looks like its a custom build step. Not sure why you would be getting that for even an empty project but maybe you found an option/place that will do this build step for *all* projects.
Hope that helps.
Jero
it isn't a custom build step actually, it's part of the build process that handles the application manifest.
the error message most likely means that cmd.exe is not in the path that the build process is launched with. this path is taken from tools->options->projects and solutions->vc++ directories, 'executable paths'. the default has $(path) as the last value so that it uses your system path, which ought to include the path to cmd.exe. if it has been modified so that it does not contain $(path), or your system path environment variable does not include the path to cmd.exe, then you can add the path to cmd.exe yourself and that should address this issue.
hth,
josh
VC++ project system developer
Thanks, JeroGrav. I will try your suggestions a little later and post the results here.
I suspect that the problem is related to the the existance of the "AutoRun" registry entry more than what's actually in it. I say this because, I too thought that switching the directory may be the culprit and tried doing a build with the "&&c:&&cd \\" removed from the "AutoRun" entry. The build still failed.
It looks like the only way to get an error free compile is to not have an "AutoRun" registry entry or to have it set to a null string ("").
after looking into it further, it is the color command that is doing this. (I still have no idea why). other commands seem to work fine.
the work-around is to remove the color command from autorun. instead set the color of the console window by using the properties menu item on the alt-spacebar menu.
hth,
josh
VC++ project system developer
All Replies
Thats certainly fairly odd.
Looking at the build log, everything is fine up until at least the building of the manifest.
My guess is that it has completed the "Embedding Manifest..." part because the exe it is actially running is mt.exe not cmd.exe.
The last command is the one that is running in a command... maybe.
Try going to c:\Documents and Settings\Stephen M. Derderian\My Documents\Development .NET\Test3\ in a command window and running the command line:
@echo Manifest resource last updated at %TIME% on %DATE% > ".\Debug\mt.dep"
Which is what its actually trying to run. If that doesn't work then you have your culprit.
It looks like its a custom build step. Not sure why you would be getting that for even an empty project but maybe you found an option/place that will do this build step for *all* projects.
Hope that helps.
Jero
Hi,
I'm having the same problem over here
C:\Documents and Settings\Alexandru\My Documents\Visual Studio 2005\Projects\ma
ki_test|► @echo Manifest resource last updated at %TIME% on %DATE% > ".\Debug\mt
.dep"C:\Documents and Settings\Alexandru\My Documents\Visual Studio 2005\Projects\ma
ki_test|►
I tryed to run the program despite of the problem but is sais that msvcr80d.dll, or it runs, and then it gets a run-time error in output.c.
it isn't a custom build step actually, it's part of the build process that handles the application manifest.
the error message most likely means that cmd.exe is not in the path that the build process is launched with. this path is taken from tools->options->projects and solutions->vc++ directories, 'executable paths'. the default has $(path) as the last value so that it uses your system path, which ought to include the path to cmd.exe. if it has been modified so that it does not contain $(path), or your system path environment variable does not include the path to cmd.exe, then you can add the path to cmd.exe yourself and that should address this issue.
hth,
josh
VC++ project system developer
Thanks for all of the replies. JeroGrav, I tried your suggestion first. Actually the line you pointed out only logs an entry to a file name mt.dep showing the last date and time that the manifest was rebuilt.I took it a step further and manually rebuilt the entire project (using the BuildLog as a guide). I checked the errorlevel after each step and all programs returned a 0. Running the build manually worked without any errors.
Next I tried josep's suggestion. My cmd.exe is in c:\windows\system32 (I'm running Windows XP Professional - Service Pack 2). The "system32" directory was in my "path" and $(path) was the last item in the "executable files" list. It looked to me like everything was set correctly, but I put "c:\windows\system32" at the top of the list just in case something further down the list was causing a conflict of some sort.
I tried rebuilding the entire project and got the same error message (Error PRJ0002, etc., etc.).
But, josep, your suggestion got me thinking about my cmd window. I've customized it using the registry to change the background color, set my favorite prompt and switch to the root directory every time a cmd prompt window is opened.
Here's how I have the registry set:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor]
"AutoRun"="color 1f&&prompt $d $t$_$p===$g &&c:&&cd \\"I tried getting rid of the "AutoRun" entry (actually I just renamed it to "NoAutoRun") and then rebuilding the project. This time it worked without any errors. I tried putting the "AutoRun" entry back with different variations of the entry value and the build failed every time. Whenever I got rid of the entry or set the value to a null string the build worked. It seems that the only way to get a clean build is to get rid of the "AutoRun" entry.
Is there any way I can have my "AutoRun" registry entry and still get my C++ projects to build cleanly?
This seems to be a bug to me. Is there any way to ask Microsoft to provide a fix to this problem?
Ah ok, things become a little clearer now.
The problem I think is that the autorun thing sets the current dir to be the root directory. Then the batch script (run the cmd) tries to create a file in .\debug.
That means that it's looking for a debug dir off you toor dir. If its not there, it will fail. To see if this is the actual problem, try to create a debug dir off your root dir. The nput your autorun reg setting back in.
It you find that it now works then thats what the problem was.
In that case you have 2 choices as far as I can see. The first is to remove the cd but from the autorun (or remove the autorun completely) permanently. The second is to change the path that is used by the batch command so instead of trying to find .\debug, it looks for your solutions debug dir explicitly.
By that I mean that it changes the line:
@echo Manifest resource last updated at %TIME% on %DATE% > ".\Debug\mt.dep"
to
@echo Manifest resource last updated at %TIME% on %DATE% > "d:\Mysolution\Debug\mt.dep"
To do that, I would look in your project settings and check what your $(OutDir) macro is. It should be set my the "Output Directory" part of Configuration properties->General.
It should be "$(SolutionDir)debug" and as long as $(SolutionDir) isn't ".\" then it should work.
Regards
Jero
Thanks, JeroGrav. I will try your suggestions a little later and post the results here.
I suspect that the problem is related to the the existance of the "AutoRun" registry entry more than what's actually in it. I say this because, I too thought that switching the directory may be the culprit and tried doing a build with the "&&c:&&cd \\" removed from the "AutoRun" entry. The build still failed.
It looks like the only way to get an error free compile is to not have an "AutoRun" registry entry or to have it set to a null string ("").
that is exactly the problem. I don't know why setting autorun causes running the batch file to fail, but it does.
Fred, could you please enter an issue at http://lab.msdn.microsoft.com/ProductFeedback/. that will enter a bug against us and we can fix it.
I haven't found any work-around so far, other than to get rid of the autorun settings. I'll post back here if I find one.
thanks for tracking this down Fred! it's certainly not something that we would have found easily.
josh
VC++ project system developer
after looking into it further, it is the color command that is doing this. (I still have no idea why). other commands seem to work fine.
the work-around is to remove the color command from autorun. instead set the color of the console window by using the properties menu item on the alt-spacebar menu.
hth,
josh
VC++ project system developer
Thanks, Josh. This bug had already been reported by another user so I just added my explaination of what was causing it.
I, too did a little additional research on this. It turns out that cmd.exe has a "/d" option. This option tells cmd.exe to ignore the "AutoRun" registry setting. Is there any way to instruct Visual Studio to put the "/d" option on the cmd.exe command line?
no, there isn't. sorry
josh
VC++ project system developer
I have the same problem. i am trying to make a cmd window app.
i tried all your suggestions and still nothing different
- edited the registry; took out the autorun key
- replaced the output in the project settings.------ Build started: Project: GPAcalc, Configuration: Debug Win32 ------
Linking...
Embedding manifest...
The system cannot find the path specified.
Project : error PRJ0002 : Error result 1 returned from 'C:\WINXPPRO\system32\cmd.exe'.
Build log was saved at "file://c:\Documents and Settings\Christopher.OAKS\My Documents\Visual Studio 2005\Projects\GPAcalc\GPAcalc\Debug\BuildLog.htm"
GPAcalc - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
i am mainly helping a friend out with his application. but this error is on my computer.
Greetings,
I share the same problem. I read all your suggestions and tried several of them. The registry thing is out of the question since i have the "/d" in the Autorun line.
I've tried doing each line in the command line, and i've realized that the BAT00001927921784.bat file is not created (i have included the build log at the end of this post).
It's the @echo Manifest resource last updated at %TIME% on %DATE% > ".\debug\mt.dep command that returns the The system cannot find the path specified error.
in the debug folder i found the executable tutorial.exe, and when i ran it, it worked fine (it was just a hello world), so how do i end this error?
Build Log Build started: Project: tutorial, Configuration: Debug|Win32
Command Lines Creating temporary file "c:\Documents and Settings\xuser53\My Documents\Visual Studio 2005\Projects\tutorial\tutorial\Debug\RSP00001827921784.rsp" with contents [ /outputresource:"..\debug\tutorial.exe;#1" /manifest ".\debug\tutorial.exe.intermediate.manifest" ] Creating command line "mt.exe @"c:\Documents and Settings\xuser53\My Documents\Visual Studio 2005\Projects\tutorial\tutorial\Debug\RSP00001827921784.rsp" /nologo" Creating temporary file "c:\Documents and Settings\xuser53\My Documents\Visual Studio 2005\Projects\tutorial\tutorial\Debug\BAT00001927921784.bat" with contents [ @echo Manifest resource last updated at %TIME% on %DATE% > ".\debug\mt.dep" ] Creating command line """c:\Documents and Settings\xuser53\My Documents\Visual Studio 2005\Projects\tutorial\tutorial\Debug\BAT00001927921784.bat"""
Output Window Embedding manifest... The system cannot find the path specified. Project : error PRJ0002 : Error result 1 returned from 'C:\WINDOWS\system32\cmd.exe'.
Results Build log was saved at "file://c:\Documents and Settings\xuser53\My Documents\Visual Studio 2005\Projects\tutorial\tutorial\Debug\BuildLog.htm" tutorial - 1 error(s), 0 warning(s)
Joao.Pio:
/d in the AutoRun entry doesn't stop the AutoRun entry from running. (It can't, if you think about it...)
You should delete the AutoRun entry entirely (at least rename it to something other than AutoRun) and try again.
HTH


