Batch File Caps Lock Num Lock <2K 2026>

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

To force a key to be "ON" only if it is currently "OFF," use PowerShell to check the status first. Batch File Caps Lock Num Lock

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