I am using PowerShell in my script to check the status of various keys like NumLock and CapsLock.
powershell.exe -Command [Console]::CapsLock
powershell.exe -Command [Console]::NumberLock
But I found no way to check the status of ScrollLock through PowerShell console command. Can you guys tell me why powershell.exe -Command [Console]::ScrollLock
does not work and what is needed to be done?
You can get the
ScrollLock
key state with theGetKeyState()
function from theuser32.dll
native Windows API: