home *** CD-ROM | disk | FTP | other *** search
- Exit Code
- by Mark Berlinger
- Version 1.0 2/10/93
- Copyright(c)1993 Mark Berlinger
-
- This variable delay program sets the exit code to the code of the key that
- was pressed before the normal timeout. Pressing a key before the normal
- timeout immediately ends the program. The timeout is from one to ninety-
- nine seconds with five seconds being the default. The user can customize
- a batch file to test the exit code to make a conditional branch.
-
- The last character or last two characters of the command tail are
- normally numbers. The numbers determine the timeout. The command tail
- is output to the monitor along with the count. If there is no command
- tail, or if the last two characters of the command tail are not numbers,
- or if the last two characters are not numbers between one and ninety-nine,
- then the default timeout is five seconds.
-
- The hexadecimal return code is shown in place of the count when a key is
- pressed before the normal timeout.
-
- This example uses a command tail string.
-
- C:\>EXITCODE Run Windows in 15
- Run Windows in 12_
-
- This demonstrates using only numbers in the command tail.
-
- C:\>EXITCODE 10
- 7_
-
- Without a command tail the delay defaults to 5 seconds.
-
- C:\>EXITCODE
- 2_
-
- Here is an example that uses EXITCODE in a batch file to bypass Windows
- when any key is pressed before the five second timeout.
-
- C:\BATCH\EXITCODE Run Windows in 5
- if errorlevel 1 goto bypasswin
- win
- :bypasswin
-
- Here is a more complex example of how EXITCODE can be used to control the
- batch file program flow. The numbers after errorlevel are decimal. Note
- in this example that the errorlevel 13 line is true if the enter key is
- pressed which enables an immediate jump to the windows label.
-
- @echo off
- .
- .
- .
- D:\BATCH\EXITCODE Run Windows or w = WordPerfect or x = Xtree 15
- if errorlevel 121 goto dosprompt
- if errorlevel 120 goto xtree
- if errorlevel 119 goto wordperf
- if errorlevel 14 goto dosprompt
- if errorlevel 13 goto windows
- if errorlevel 1 goto dosprompt
- :windows
- rem Set 500 locks for ACCESS:
- c:\dos\share.exe /L:500
- win
- goto done
- :wordperf
- wp
- goto done
- :xtree
- xtg
- :done
- c:\dos\chkdsk
- :dosprompt
-
- If you find this program to be useful, then please send six dollars US to:
-
- Mark Berlinger CIS 70134,3016
- 1317 N. San Fernando Blvd. #133
- Burbank, CA 91504
-
- I'll return the source code and a registered version on a 3-inch diskette.
-