多个循环了- @echo off & setlocal enabledelayedexpansion
- set "s=10X98765432"
- set "sx=79a584216379a5842"
- for /l %%i in (0,1,10) do set #!s:~%%i,1!=%%i
- for /f "delims=#" %%i in ('findstr /ib # %0') do (
- set id=%%i
- set e=!id:~-1!
- set n=0&set "?="
- for /l %%k in (0,1,16) do (
- set /a n+=!id:~%%k,1!*0x!sx:~%%k,1!
- set "!id:~%%k,1!=!sx:~%%k,1!"
- )
- set /a n%%=11
- if defined ? for /l %%i in (0,1,9) do (
- set/a "x=(%%i*?+n) %% 11"
- for %%j in (!e!) do if !x! equ !#%%j! set "id=!id:?=%%i!"
- )
- echo;!id!
- )
-
- pause & exit
-
- #15?923198804239619
- #3700001989091894?0
- #4313021981042877?1
- #5301021920050801?X
- #611?25199006287480
复制代码
|