|
本帖最后由 527104427 于 2014-6-9 22:07 编辑
这样就好了:
- :hwid_check
- set tmp=
- if "%~3"=="" && exit
- ::不以 ms_ 开头则继续搜索
- cat --length=0x%~3 --locate="\xD\xA" %inipath% > nul
- calc %?% + 2 > nul
- cat --skip=%@retval% --length=3 --locatei="ms_" %inipath% > nul
- calc %?% > nul || shift 3 && goto :hwid_check
- ::不以 , 或 " 结尾则继续搜索
- ::比如ID为PCI\VEN_1000&DEV_0054,搜到的却是PCI\VEN_1000&DEV_0054&SUBSYS_1F041028
- calc 0x%~3 + 16 > nul
- cat --skip=%@retval% --length=1 %inipath% | set tmp=
- ::加引号比较字符串大小会转为ascii码再比较
- if "%tmp%">="0x22" if "%tmp%"<="0x22" || if "%tmp%"=="," || shift 3 && goto :hwid_check
- calc 0x%~3 - %~2 + 16 > nul
- cat --skip=%@retval% --length=%~2 %inipath% | set /u tmp=
- call Fn.15 "%~1" "%tmp%" && shift 3 && goto :hwid_check
- ::tmp值为匹配ID位置
- set /a tmp=0x%~3 - %~2 + 16 > nul
- exit
复制代码 |
|