KLOCKS Commandline Lock Keys Controller

About Klocks


About Klocks

Klocks is a Win32 commandline utility for NT4/W2K/XP/2003 that allows the Num, Caps and Scroll lock keys to be turned on, off or toggled.

Klocks is a tiny standalone Win32 executable. It does not create any temporary files, nor does it write to the registry. There is no installation procedure, just run it. To completely remove all traces of it from your system, delete it.

Klocks was written with batch file programmers in mind, and the output is easily parsed using the 'FOR /F' command found in NT4/W2K/XP/2003. Klocks is simple and intuitive to use. To list all its options, type klocks /?.


KLOCKS [+key | -key | !key] [...]

+ Turns the specified key on.
- Turns the specified key off.
! Toggles the specified key.
key Key to be controlled. [N]um, [C]aps or [S]croll (either the first letter can be used or the full name of the key).
... Additional keys to control (more than one key can be controlled).
If no options are specified, the current status of the Num, Caps and Scroll lock keys is displayed, where 0 = off and 1 = On.

View the Klocks main help screen:-

klocks /?

Display the current Lock keys status:-


Typical output from the above command showing that only the Num lock is on:-

Num:1 Caps:0 Scroll:0

Turn on the Num lock:-

klocks +n

Toggles Num and Caps lock.:-

klocks !num !caps

Turns on Scroll lock and turns off Num and Caps lock:-

klocks +scroll -num -c

Batch file to continuously flash all Lock indicator lights:-

@echo off
:: Turn all lights on
klocks +n +c +s
ping -n 2 >nul
:: Toggle all lights
klocks !n !c !s
goto :top

Batch file to parse klocks output using a colon and a space as delimiters:-

@echo off
for /f "tokens=2,4,6 delims=: " %%a in ('klocks') do (
  set num=%%a
  set cap=%%b
  set scr=%%c
if %num%==1 (echo/Num is on) else (echo/Num is off)
if %cap%==1 (echo/Caps is on) else (echo/Caps is off)
if %scr%==1 (echo/Scroll is on) else (echo/Scroll is off)