Lock — Batch File Caps Lock Num

Windows Batch (.bat) files cannot natively control or check the status of or Num Lock because the CMD language lacks built-in commands for hardware state . To achieve this, a batch file must "spawn" a script using PowerShell or VBScript . Toggling via PowerShell (Recommended)

powershell.exe -Command "IF ([console]::CapsLock -eq 'False') { ... }" Super User Batch File Caps Lock Num Lock

powershell.exe -Command "$wsh = New-Object -ComObject WScript.Shell; $wsh.SendKeys('{NUMLOCK}')" Ensuring a Specific State (IF Logic) Windows Batch (

powershell.exe -Command "$wsh = New-Object -ComObject WScript.Shell; $wsh.SendKeys('{CAPSLOCK}')" Batch File Caps Lock Num Lock