[GEM Development] Batch File Ansser (for OpenGEM 4)

info at maxframe.com info at maxframe.com
Wed Jun 8 22:12:28 PDT 2005


Shane,

Thanks so very much for all you're doing with GEM!

Yes, you're generally correct on the initial batch file syntax but don't
count on an "else" being supported.  Use a dual if set instead.  Another
thing to keep in mind is that if you directly invoke another batch file from
within a batch file the command processor will release the first batch file
at that point and only execute the invoked batch file.  The way to have it
continue within the same batch file is to use the "call" command as follows:

:START
@echo off
::
if exist c:\gemapps\gemsys\update\update.zip goto UPDATE
if not exist  c:\gemapps\gemsys\update\update.zip goto CONTINUE
::
:UPDATE
call c:\gemapps\gemsys\update\gemunzip.bat
::
:CONTINUE
(rest of commands in batch file)
::
:EXIT
exit
:END

Note that a single colon (:) in front of a name defines a LABEL.  The use of
double colons per above is simply ignored but is useful for separate of
segments within a batch file.  The call command is only applicable to batch
files called within batch files.  A command to do an executable will
continue control of the batch file after the .EXE or .COM or .CMD is
finished executing.

I hope this helps and if you need any other info on batch files, let me
know.  We wrote the most advance implementation of batch files ever done
with MaxFrame for REAL/32 and if you want to see some really fancy games
with batch files take a look at it sometime.

We also did a very useful C++ file called DATETIME.EXE that breaks down date
and time into 32 components and sets each component as an environment
variable that can be then reassembled to create directory names with the
date for archiving and other purposes.  The key to real power in batch files
is the use of environment variables which can be used to intelligently play
with all kinds of settings.  We also did an interesting implementation of
errorlevel called XLEVEL.BAT.

Thanks again for all you're doing with GEM!

Best Regards,

Jim R. Benfer Jr.
MaxFrame Corporation

>Hi guys
>
>I'm trying to work out how to add some lines to GEM.BAT so it'll look in a
>folder for a file, and if the file is there it'll execute another batch
>file.  If the file is not there it'll just continue loading GEM.  This will
>be a feature for the automatic detection of new updates and applications.
>
>I can't remember how to do it!
>
>Is something like this along the right lines?
>
>
>IF EXIST C:\GEMAPPS\GEMSYS\UPDATE\UPDATE.ZIP GOTO UPDATE ELSE GOTO 1
>
> :UPDATE
> UNZIP C:\GEMAPPS\GEMSYS\UPDATE\UPDATE.ZIP -d
> GOTO 1
>
> :1
>
>
>

 IF EXIST C:\GEMAPPS\GEMSYS\UPDATE\UPDATE.ZIP GOTO UPDATE ELSE GOTO 1
>
> :UPDATE
> UNZIP C:\GEMAPPS\GEMSYS\UPDATE\UPDATE.ZIP -d
> GOTO 1
>
> :1
>
>
>

----- Original Message ----- 
From: "Shane M. Coughlan" <shane_coughlan at hotmail.com>
To: <gem-dev at simpits.org>
Sent: Wednesday, June 08, 2005 8:04 PM
Subject: [GEM Development] batch file question (for OpenGEM 4)


> Hi guys
>
> I'm trying to work out how to add some lines to GEM.BAT so it'll look in a
> folder for a file, and if the file is there it'll execute another batch
> file.  If the file is not there it'll just continue loading GEM.  This
will
> be a feature for the automatic detection of new updates and applications.
>
> I can't remember how to do it!
>
> Is something like this along the right lines?
>
> IF EXIST C:\GEMAPPS\GEMSYS\UPDATE\UPDATE.ZIP GOTO UPDATE ELSE GOTO 1
>
> :UPDATE
> UNZIP C:\GEMAPPS\GEMSYS\UPDATE\UPDATE.ZIP -d
> GOTO 1
>
> :1
>
>
>
> Orrrrrrrrrr should it be something using ERRORLEVELS?
>
> Please help!
>
> Regards
>
> Shane
> _______________________________________________
> gem-dev mailing list
> gem-dev at simpits.org
> http://www.simpits.org/mailman/listinfo/gem-dev
>
>
>



More information about the gem-dev mailing list