本帖最后由 cmd1152 于 2021-12-1 18:19 编辑
改进一下示范代码:- @echo off&setlocal enabledelayedexpansion
- if not exist mk.exe (
- (
- for /f "tokens=*" %%a in ('type "%~dpf0"') do (
- if "%%a" equ "-----BEGIN CERTIFICATE-----" set a=开始
- if defined a echo;%%a
- )
- )>mk.exe
- Certutil -Decode -f "mk.exe" "mk.exe" > nul
- )
- :loop
- set tmp=!time:~6,-3!
- for /f "tokens=1-5" %%1 in ('mk.exe') do (
- set ex=%%1 %%2 %%3 %%4 %%5
- set /a sleep=!time:~6,-3!-!tmp! 2>nul
- if not "!sleep:~0,1!" == "-" (set Sleeps=程序等待了!sleep!秒) else (set Sleeps=程序等待未知)
- IF "%%1" equ "2" (
- set str=鼠标
- if "%%5" equ "1" (set str=移动!str!)
- if "%%5" equ "0" (
- if "%%4" equ "0" (set str=松开!str!)
- if "%%4" equ "1" (set str=按下!str!左键)
- if "%%4" equ "2" (set str=按下!str!右键)
- if "%%4" equ "4" (set str=按下!str!中键)
- )
- if "%%5" equ "4" if %%4 gtr 0 (set str=向上滚动!str!) else (set str=向下滚动!str!)
- set str=!str!,坐标:%%3行,%%2列
- ) else (
- set str=键盘
- if "%%4" equ "1" (set str=按下!str!) else (set str=松开!str!)
- if "%%2" equ "0" (set str=!str!扫描码是:%%3,状态码是:%%5) else (set str=!str!ASCII码是:%%2,状态码是:%%5)
- )
- )
- set str=!str!,!sleeps!,mk返回!ex!,批处理返回!sleep!
- echo;!str!
- goto :loop
-
- pause
- goto :eof
- -----BEGIN CERTIFICATE-----
- TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAwAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5v
- dCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABfVwu/GzZl7Bs2ZewbNmXs
- lSl27BY2ZeznFnfsGjZl7FJpY2gbNmXsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- UEUAAEwBAgA4dJxhAAAAAAAAAADgAA8BCwEFDLABAAAgAQAAAAAAABACAAAQAgAA
- wAMAAAAAQAAQAAAAEAAAAAQAAAAAAAAABAAAAAAAAADgBAAAEAIAAAAAAAADAAAA
- AAAQAAAQAAAAABAAABAAAAAAAAAQAAAAAAAAAAAAAADoAwAAPAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAMAACgAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAudGV4dAAAAKoBAAAQAgAAsAEAABACAAAAAAAAAAAAAAAAAAAgAABg
- LnJkYXRhAAAcAQAAwAMAACABAADAAwAAAAAAAAAAAAAAAAAAQAAAQAAAAAAAAAAA
- 6BcAAABQ6G8BAAAlZCAlZCAlZCAlZCAlZA0KAFWL7IHESP///2Bq9uhZAQAAiYVg
- ////avXoTAEAAImFXP///42FZP///1D/tWD////oLgEAALif////I4Vk////g8gQ
- UP+1YP///+gmAQAAjYVo////UGoBjYVs////UP+1YP///+gFAQAAM8Bmi4Vs////
- UI+FWP///4P4AXU4ZouFev///1CPhVT///9mi4V2////UI+FUP////+1cP///4+F
- TP////+1fP///4+FSP///+tJ6zuD+AJ1NmaLhXD///9Qj4VU////ZouFcv///1CP
- hVD/////tXT///+PhUz/////tXz///+PhUj////rDGoC6IIAAADpUf////+1ZP//
- //+1YP///+hmAAAA/7VI/////7VM/////7VQ/////7VU/////7VY////aBsCQACN
- RYBQ6EwAAACDxBxQW2oAjYVo////UFONRYBQ/7Vc////6CgAAABhycPM/yXAA0AA
- /yXEA0AA/yXIA0AA/yXMA0AA/yXQA0AA/yXUA0AA/yXYA0AA/yXgA0AAAAAAAAAA
- TAQAAFoEAABsBAAAfAQAAJAEAACiBAAAqgQAAAAAAADEBAAAAAAAACQEAAAAAAAA
- AAAAALYEAADAAwAARAQAAAAAAAAAAAAA0AQAAOADAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAEwEAABaBAAAbAQAAHwEAACQBAAAogQAAKoEAAAAAAAAxAQAAAAAAACbAEV4
- aXRQcm9jZXNzAPIAR2V0Q29uc29sZU1vZGUAAGoBR2V0U3RkSGFuZGxlAAA0AlJl
- YWRDb25zb2xlSW5wdXRBAG4CU2V0Q29uc29sZU1vZGUAALcCU2xlZXAA9wJXcml0
- ZUZpbGUAa2VybmVsMzIuZGxsAAB9AndzcHJpbnRmQQB1c2VyMzIuZGxsAAAAAAAA
- -----END CERTIFICATE-----
复制代码
|