command turn on/off capslock key in .bat file

Microsoft Windows xp professional w/sp2
May 19, 2010 at 10:47:54
Specs: Windows XP
i found some program that turn caps lock off or on if we need
and found some .com program and scripts for this job
my question= is there a way to turn caps lock off without using any external program?
just using batch codes?
is it possible?
if its so please let me know

See More: command turn on/off capslock key in .bat file

Report •

May 19, 2010 at 16:42:02
no. you can't using unassisted batchscript. Here are a couple of "assistants". First, vbscript to set the lock:
VBSCRIPT "capslok.vbs":
dim wsh
set wsh=createobject("")
'note that this is set to turn capslock ON regardless. x mod 2=1 will set it OFF
if x mod 2 =0 then wsh.sendkeys ("{capslock}")
'----------------- end
unfort. that is completely useless without knowledge of the key's status. This will read the locks keys as binary digits, 1 bit per lock, in order: scroll, num, caps:
@echo off & setlocal
:: read & report the status of the locks-keys: scoll:num:caps output as boolean/binary
:: note that addr 0:497 could also be used, not sure what the diff. is
:: the foll. is ALL ON ONE LINE up to /including the goto
for /f "skip=1 tokens=2" %%a in ('(echo d0:417,417 ^&echo q^) ^|debug') do set byte=%%a & goto :xx
:: bits are: 1=scroll, 2=nums, 4=caps. Masks 0x10, 0x20, 0x40 resp.
:: you can change the order of output bits: 20,40,10 will match indic.lights
for %%i in (10 20 40) do call :aa %%i
echo %out%
cscript capslok.vbs %out%
goto :eof

set /a test=(0x%byte%"&"0x%1)/0x%1
set out=%out%%test%
::------ end

A whole lot of bother for something so trivial, huh! oh well...
on older systems (preXP), you could set the locks directly in
memory (0000:0417). but MS doesn't like us to have that much control without going through more hoops.

Report •
Related Solutions

Ask Question