home *** CD-ROM | disk | FTP | other *** search
-
- KBFLAG -- by Nico Mark -- from PC Magazine, December 23, 1986
-
- KBFLAG can be used to cause branching in batch files, so that execution of
- different parts of the file can be dependent on the state of toggle and shift
- keys. You can, for example, abort execution of AUTOEXEC.BAT if the CapsLock
- key has been toggled while CONFIG.SYS in running.
-
- KBFLAG tests for a keystroke in the buffer, and sets errorlevel to the value of
- the key's KBFLAG in the ROM BIOS. Thus, if the Ins key has been toggled, it
- will return an errorlevel of 128. Other values are:
-
- 1 = Right Shift
- 2 = Left Shift
- 4 = Ctrl key
- 8 = Alt key
- 16 = ScrollLock
- 32 = NumLock
- 64 = CapsLock
- 128 = Ins
-
- (You can use sums of these values to correspond to combinations of keys, so
- 96 = CapsLock and NumLock together.)
-
- If you put these lines at the start of autoexec.bat--
-
- KBFLAG
- IF ERRORLEVEL 64 GOTO :END
-
- --and put the label :END at the end of the file, autoexec.bat will then check
- to see if CapsLock has been pressed, and will jump the end of the batch if it
- has. To prevent autoexec.bat from executing on bootup, simply hit CapsLock
- while config.sys is running.
-
- You can use variations of this technique to cause different sets of programs
- to run during autoexec.bat (or any batch file). For example, Caps Lock could
- cause only a few programs to run; Alt + CapsLock could cause others; etc.
-
-