How do your return an error code to a Dos batch file from 32bit C code that makes a call to the windows API? When calling a 32bit console app from a batch file, the batch file executes the program and continues instead of waiting for the return code. If you use cscript.exe to run script code, however, the batch file will wait for the return code, so there must be a way to compile the C code that allows DOS to receive the return value.