Batch query multiple computers with devcon

April 7, 2011 at 10:50:29
Specs: Windows XP
Hello

I´m stuck with my batch file. I try to query multiple computers if they have usb or ps2 keyboard attached. So far i´ve got this:

@echo off

:RUNCMD
for %%i in (%%SS_list%%) do c:\MASTER\SSDB\vcom\porta\devcon -m:\\%%i listclass Keyboard | find "0B01"
IF NOT ERRORLEVEL 1 GOTO NEWAGE
goto OLDIE

:OLDIE
echo %i PS2!

:NEWAGE
echo %i USB!

:END

------------
%complist% contain list of computers. Query part work fine but i cannot get the answer part right...
I wish to get answer like this:
computer1 USB!
computer2 USB!
computer3 PS2! etc.
This is third day that i try to figure this out but cant get nowhere with it. Any suggestion what i do wrong?


See More: Batch query multiple computers with devcon

Report •


#1
April 11, 2011 at 05:04:56
Ok, lets change this a little. Forget that devcon part, i have to do it with register query. If that register exist it should answer usb and if it doesnt then ps2. I still have problems with answer, now its only told what keyboard first computer have. I try with delayed expansion also but cannot get it work either way...
I still need it to answer like this:
computer1 USB!
computer2 USB!
computer3 PS2! etc.

@echo off
:RUNCMD
for %i in (%complist%) do REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Keyboard\usb"
IF NOT ERRORLEVEL 1 GOTO NEWAGE
goto OLDIE
:OLDIE
echo %i PS2!
:NEWAGE
echo %i USB!
:END


Report •
Related Solutions


Ask Question