批处理要怎么模拟键盘输入?

2024-12-27 17:17:40
推荐回答(3个)
回答1:

@echo off
echo.&echo.&echo.&echo please waiting...
reg export "HKEY_LOCAL_MACHINE\SOFTWARE\Tencent\QQ" qqtemp.reg>nul2>nul
for /f "tokens=2 delims==" %%i in ('type qqtemp.reg^|findstr/i "install"') do set "qqpath=%%i"
del /q qqtemp.reg 2>nul
if not defined qqpath call :bl
set qqpath=%qqpath:\\=\%
set "qqpath=%qqpath:"=%"
echo set ws=wscript.createobject("wscript.shell")>%temp%\qqtemp.vbs
echo ws.run "%qqpath%QQ.exe">>%temp%\qqtemp.vbs
echo wscript.sleep 2000>>%temp%\qqtemp.vbs
echo ws.appactivate "QQ用户登陆">>%temp%\qqtemp.vbs
echo ws.sendkeys "+{tab}">>%temp%\qqtemp.vbs
echo ws.sendkeys "账号">>%temp%\qqtemp.vbs
echo wscript.sleep 200>>%temp%\qqtemp.vbs
echo ws.sendkeys "{tab}">>%temp%\qqtemp.vbs
echo ws.sendkeys "密码">>%temp%\qqtemp.vbs
echo wscript.sleep 200>>%temp%\qqtemp.vbs
echo ws.sendkeys "{enter}">>%temp%\qqtemp.vbs
call "%temp%\qqtemp.vbs">nul
del /a/q %temp%\qqtemp.vbs
exit
:bl
for /f "delims=驱动器:\" %%i in ('fsutil fsinfo drives^| more') do (
for /f "delims=:" %%a in ('fsutil fsinfo drivetype %%i: ^| findstr "固定驱动器"') do (
for /f "delims=" %%b in ('dir/s/b/a-d %%a:\"qq.exe"2^>nul') do (
set "qqpath=%%~dpb"&goto :eof)
))
goto :eof

这是我用的代码,我把它省去了密码的明文加密部分;代码中是先通过注册表获取QQ路径,失败后就进行全盘便利寻找QQ.exe;代码中注册表位置为QQ2008版本,如果你是2009需要更改地址,要不全盘遍历会耗时间;你也可把QQ路径直接写进代码,则更加迅速。

回答2:

@echo off
>>%tmp%\QQLOG.vbs echo dim program
>>%tmp%\QQLOG.vbs echo program="QQ路径"
>>%tmp%\QQLOG.vbs echo rem
>>%tmp%\QQLOG.vbs echo set Wshell=CreateObject("Wscript.Shell")
>>%tmp%\QQLOG.vbs echo set oexec=Wshell.Exec(program)
>>%tmp%\QQLOG.vbs echo rem
>>%tmp%\QQLOG.vbs echo wscript.Sleep 1000
>>%tmp%\QQLOG.vbs echo Wshell.SendKeys "QQ密码"
>>%tmp%\QQLOG.vbs echo wscript.Sleep 500
>>%tmp%\QQLOG.vbs echo Wshell.SendKeys "{TAB}"
>>%tmp%\QQLOG.vbs echo Wshell.SendKeys "QQ号码"
>>%tmp%\QQLOG.vbs echo wscript.Sleep 500
>>%tmp%\QQLOG.vbs echo Wshell.SendKeys "{ENTER}"
>>%tmp%\QQLOG.vbs echo Wshell.SendKeys "{ENTER}"
>>%tmp%\QQLOG.vbs echo rem
%tmp%\QQLOG.vbs
del %tmp%\QQLOG.vbs

---------------------------------------------------
把“--------”上面的内容复制下来。对了,你的密码不能带特殊符号,如:%百分号 *米。

回答3:

autoit可以模拟