Batch File Caps Lock Num Lock May 2026

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

Can I turn Caps on/of from a batch file in Win 7? - Super User Batch File Caps Lock Num Lock

To force a key to be "ON" only if it is currently "OFF," use PowerShell to check the status first. powershell

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