Dec 312017
 
Easy solution to multiple AUTOEXEC.BAT's. C source and EXE file.
File SETEXEC.ZIP from The Programmer’s Corner in
Category Utilities for DOS and Windows Machines
Easy solution to multiple AUTOEXEC.BAT’s. C source and EXE file.
File Name File Size Zip Size Zip Type
SETEXEC.C 1971 903 deflated
SETEXEC.DOC 1284 721 deflated
SETEXEC.EXE 11618 7133 deflated
VIDTYPE.C 4166 1184 deflated

Download File SETEXEC.ZIP Here

Contents of the SETEXEC.DOC file


Here's a real simple solution to the problem of multiple configurations at
boot up. Being a simple solution, it's not very powerful, but it should
be helpful to someone. It prompts the user for an errorlevel to set. If
none is given in 2 seconds, it times out and sets the errorlevel to zero.

You would put it in your autoexec and then test for the errorlevel and
branch to whatever setup you want, like this:

rem Autoexec.bat
@echo off
prompt $p$g
path=c:\;c:\dos;..

setexec
if errorlevel 9 goto LOAD_W3
if errorlevel 8 goto LOAD_ACAD
if errorlevel 7 goto LOAD_PMENU

...

:END

Come to think of it, this utility is no more than a glorified GETKEY
(a fairly classic debug-script file that gets a key and sets an errorlevel
(exit code) based on the ascii value of the key). Oh well, at least it's
got a timeout. The idea behind the code is one I've been using a lot
lately: query the PC (vidtype.c, included) or the user for an a piece
of information (the video card, a menu choice) and set an errorlevel. Use
a batch file to employ the errorlevel as a decision-maker.

The good thing about this idea is it is LANGUAGE INDEPENDENT. All PC
programming languages (I think) have an equivalent of C's exit() function
(e.g., GODOS() in CLARION).


 December 31, 2017  Add comments

Leave a Reply