Thursday, July 23, 2009 5:45 pm
KeyState is a new batch file utility that allows you to easily determine if a key is being held down when the batch starts or at any time during execution. For example, you could have a batch file behave differently if the user holds the Control Key down while launching the batch.
In addition, options in KeyState allow a batch to change the CapsLock, NumLock, or ScrollLock states. For example, if you are prompting for a password, you could programmatically turn off the CapsLock before prompting for the password.
KeyState - Copyright (C) 2009, Incode Systems, Inc.
Version 0.9.1 www.incodesystems.com sales1@incodesystems.com
Usage: [options] VirtualKeyCode
Sets the ERRORLEVEL to 1 if the key or mouse button corresponding
to the given VirtualKeyCode is down.
VirtualKeyCode may be a hex number or one of the following symbols:
Shift,Control,Menu (or Alt),
LShift,RShift,LControl,RControl,LMenu (or LAlt),RMenu (or RAlt)
LButton,RButton,MButton
The following are toggle keys. KeyState sets ERRORLEVEL 1 if
the key is down, 2 if toggled on, 3 if toggled on and down:
Capital (or CapsLock),NumLock,Scroll (or ScrollLock)
Options:
-is_toggle Indicates the VirtualKeyCode is a toggle key.
(needed for hex number, automatic for CAPITAL,NUMLOCK,SCROLL)
-off Indicates a toggle should be set to off.
-on Indicates a toggle should be set to on.
-toggle Toggles the give key.
-verbose (or -v) writes message to standard output.
ERRORLEVEL is 255 if syntax error.
KeyState - Copyright (C) 2009, Incode Systems, Inc.
To see complete usage, type: KeyState /? | MORE