Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   How to get VisualBuild (3.x) to recognize ERRORLEVEL from a batch file? (https://www.kinook.com/Forum/showthread.php?t=260)

gilc 12-10-2003 11:39 AM

How to get VisualBuild (3.x) to recognize ERRORLEVEL from a batch file?
 
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

gilc 12-10-2003 03:47 PM

Never mind, I got it.

I was using:

%DOSCMD% file.bat

What needs to be done is:

%DOSCMD% call file.bat

In case anybody else needed to know.


All times are GMT -5. The time now is 08:32 AM.


Copyright © 1999-2023 Kinook Software, Inc.