gilc
12-10-2003, 12:39 PM
In Windows2000 and later we have the ability to exit a batch file and have it return an error code:
for instance
exit /b %ERRORLEVEL%
But, since batch files are invoked via %DOSCMD% which is for simplicity cmd.exe /c, the error value that visual build knows about is from cmd.exe, not the batch file. cmd.exe doesn't seem to pass this error back. As far as cmd.exe knows (thus Visual Build) cmd.exe executed just fine. It doesn't seem to have an issue with built in commands like copy. They fail and Visual Build knows about it.
I realize there's probably nothing Kinook can do about it, but I would like to be able to have a batch file failure stop my build.
The only way I can think of is to write my own .exe that launches the batch file via shell and get the return code, but I haven't tested it to see if even that is possible.
But in case somebody has already solved this issue, I'd like to hear about your solution.
FYI: using Visual Build 3.5b on WindowsXP Pro
Thanks
for instance
exit /b %ERRORLEVEL%
But, since batch files are invoked via %DOSCMD% which is for simplicity cmd.exe /c, the error value that visual build knows about is from cmd.exe, not the batch file. cmd.exe doesn't seem to pass this error back. As far as cmd.exe knows (thus Visual Build) cmd.exe executed just fine. It doesn't seem to have an issue with built in commands like copy. They fail and Visual Build knows about it.
I realize there's probably nothing Kinook can do about it, but I would like to be able to have a batch file failure stop my build.
The only way I can think of is to write my own .exe that launches the batch file via shell and get the return code, but I haven't tested it to see if even that is possible.
But in case somebody has already solved this issue, I'd like to hear about your solution.
FYI: using Visual Build 3.5b on WindowsXP Pro
Thanks