AW: [Mono-list] Windows: Propagating exit codes in .bat files?

Cory Nelson phrosty@gmail.com
Mon, 3 May 2004 11:13:48 -0700


Why not just package a small wrapping mcs.exe to stick in \Windows
with the install?

#include <string.h>
#include <windows.h>

int main(void) {
  char *cmdline=GetCommandLine();
  char *args=strchr(cmdline, ' ');

  char mcs[MAX_PATH]="C:\\mono\\mono.exe C:\\mono\\mcs.exe";
  if(args!=NULL) strcat(mcs, args);

  return system(mcs);
}

On Mon, 03 May 2004 22:58:43 +0530, Shantanu Kumar <shantanu@ax100.net> wrote:
> 
> On Mon, 2004-05-03 at 13:33, Jochen Wezel wrote:
> > Hi!
> >
> > Please pay attention: in Win98, there is no /b parameter available.
> > A line as EXIT %ERRORLEVEL% exits, but I cannot say if it only exits the batch or the COMMAND.COM (that is the intended usage for the /B parameter in CMD.EXE)
> >
> > In Win95, the EXIT command might be missing. I haven't tested, but I cannot remember to have seen it.
> >
> > Another chance for Win9x systems would be to provide .COM files instead of .BAT files. But this would need some knowledge on building .COM files I haven't got.
> >
> 
> Building COM files is straightforward. The entire file-content is loaded at offset address 0x100 and all segment registers are initialised same as CS. There used to be a utility called Exe2Bin to convert EXE into COM files and probably even TLINK (from the old toolchain from Borland) can do this.
> 
> Regards,
> Shantanu
> 
> 
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>