Skip to content

About

Freeze Num Lock in the on position on Windows. Forces it on at boot and disables the key itself, so nothing can toggle it off.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

FreezeNumLock

Freeze Num Lock in the on position on Windows — so the key can never turn it off again.

Read this in Français.

Platform PowerShell License

The problem

You use the number pad for numbers. Always. But Num Lock is a toggle, and sooner or later something turns it off — a stray keypress, a game, a reboot, a KVM switch. You only notice ten minutes later, when the digits have quietly become arrow keys and Home/End.

Windows has a setting for the startup state, but nothing to stop the key itself. FreezeNumLock does both.

What it does

Two changes, applied together:

# Change Registry location
1 Num Lock is switched on at boot and at every sign-in InitialKeyboardIndicators = 2147483650 in HKEY_USERS\.DEFAULT and in each loaded user profile
2 The Num Lock key stops responding entirely Scancode Map in HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layout, remapping scancode 0x45 to nothing

Change 1 alone is not enough — it only sets the state at startup, so an accidental keypress still breaks it during the session. Change 2 is what makes it stick.

Nothing is installed, nothing runs in the background, no scheduled task, no service. The script only writes two registry values and exits.

Installation

Option 1 — Download (recommended)

  1. Click Code → Download ZIP at the top of this page.

  2. Extract it anywhere (Desktop, Documents, wherever).

  3. Windows tags files that came from the internet, which can make PowerShell refuse to run them. Right-click FreezeNumLock.ps1 → Properties → tick Unblock → OK. Or, from PowerShell:

    Unblock-File .\FreezeNumLock.ps1
  4. Double-click FreezeNumLock.bat.

Option 2 — Clone

git clone https://github.com/Defacedz/FreezeNumLock.git
cd FreezeNumLock
.\FreezeNumLock.ps1 -Action Status

Cloned files are not tagged as web downloads, so no unblocking is needed.

Usage

Double-click FreezeNumLock.bat and pick from the menu:

  1  Freeze     - force Num Lock on, freeze the key
  2  Unfreeze   - undo everything
  3  Status     - show the current state
  Q  Quit

Or drive it directly from PowerShell:

.\FreezeNumLock.ps1 -Action Install     # freeze
.\FreezeNumLock.ps1 -Action Uninstall   # unfreeze
.\FreezeNumLock.ps1 -Action Status      # report only, changes nothing

Install and Uninstall need administrator rights — the script raises a UAC prompt on its own, no need to launch an elevated shell yourself. Status is read-only and runs unelevated.

A reboot is required after freezing or unfreezing: the keyboard driver reads the Scancode Map only at startup. Until you reboot, the key keeps working normally.

Sample output:

  Current state
  -------------
  Num Lock right now:                ON
  Num Lock key frozen:               YES
  Other key remappings present:      none

  Startup state per profile:
    .DEFAULT                                   forced ON (2147483650)
    S-1-5-21-1234567890-...                    forced ON (2)

Good to know

  • It affects every keyboard on the machine. The Scancode Map is machine-wide, not per-device. A laptop's built-in keyboard loses its Num Lock key too. If you only want to disable the key on one specific keyboard, use that keyboard's own software instead (Cooler Master MasterPlus+, Logitech G HUB, ASUS Armoury Crate...).
  • Existing remappings are preserved. The script parses the current Scancode Map and merges its entry in, rather than overwriting the value. If you already remapped Caps Lock or anything else, it survives — and unfreezing removes only the Num Lock entry.
  • A backup is written to backup\ScancodeMap.original.txt the first time you freeze, recording the raw value exactly as it was found.
  • Num Lock is switched on before the key is frozen, so you can't end up locked out with the key dead and the state off.
  • Safety net. If Num Lock ever does end up off while the key is frozen, open the on-screen keyboard (osk.exe) and click Num Lock there. The startup setting also switches it back on at the next reboot.

How the Scancode Map works

The Scancode Map value is a binary blob read once by the keyboard driver at boot:

00 00 00 00   header version
00 00 00 00   header flags
02 00 00 00   entry count (mappings + terminator)
00 00 45 00   mapping: scancode 0x45 (Num Lock) -> 0x0000 (nothing)
00 00 00 00   terminator

Each mapping is four bytes, little-endian: the two first are the new scancode, the two last the original one. Mapping a key to 0x0000 disables it. This is a documented Windows mechanism, not a hack or a hook.

Manual removal

If you ever want to undo this without the script:

# Restore the Num Lock key (removes ALL remappings, including any others you had)
Remove-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Keyboard Layout' -Name 'Scancode Map'

# Restore the default startup behaviour
Set-ItemProperty 'Registry::HKEY_USERS\.DEFAULT\Control Panel\Keyboard' `
  -Name InitialKeyboardIndicators -Value '2147483648' -Type String

Both commands need an elevated PowerShell, followed by a reboot. Prefer -Action Uninstall, which only removes its own entry.

Requirements

Windows 10 or 11, Windows PowerShell 5.1 (ships with Windows). No dependencies, no .NET install, no admin rights for Status.

License

MIT — see LICENSE.

About

Freeze Num Lock in the on position on Windows. Forces it on at boot and disables the key itself, so nothing can toggle it off.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages