『楼 主』:
[原创]******北京身份证号码生成器*******
@echo off
setlocal enabledelayedexpansion
:::::::::::::::::::::::::::::::::::::BeiJing ID Card No. Creator:::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::: {s11ss 2007-9-20} :::::::::::::::::::::::::::::::::::::
echo Warning:
echo This tool is only used to be technical studying.Please confirm the viewpoint:
echo.
set /p is=I agree with the view.(y/n)
if not %is% equ y (
if not %is% equ Y goto :eof
)
if not exist id.tmp (
set /a n=0
< "%~f0" more +138 >id1.tmp
copy nul id2.tmp >nul
for /f "skip=2 eol= delims=" %%a in (id1.tmp) do (
echo %%a>>id2.tmp
)
del id1.tmp
for /f "delims=" %%a in ('findstr /n .* id2.tmp') do (
set "str=x%%a"
(echo.!str!)>>id.tmp
)
del id2.tmp
)
for /f "delims=" %%a in ('findstr /n .* id.tmp') do (set /a n+=1)
for /f "tokens=1* delims= " %%a in (id.tmp) do (
set "str=%%a"
set str=!str:~0,-6!
set str=!str:x=!
set str=!str::=.!
echo !str! %%b
)
:add
echo Please choose the direction by inputting the index,like 8:
set /p position=
call :chkchoice %position% add
if !position! gtr !n! call :w index 1 !n! add
if !position! lss 1 call :w index 1 !n! add
for /f "delims=: tokens=1*" %%a in ('findstr "x!position!:" "id.tmp"') do (
set str=%%b
set AddCode=!str:~0,6!
)
goto :birth
:birth
echo Please input the birthday,like 19870307:
set /p BirthCode=
if !BirthCode! gtr 21080101 call :w birthday 18850101 21080101 birth
if !BirthCode! lss 18850101 call :w birthday 18850101 21080101 birth
set m=%BirthCode:~4,2%
if !m! lss 1 call :w month 1 12 birth
if !m! gtr 12 call :w month 1 12 birth
set y=%BirthCode:~0,4%
set d=%BirthCode:~6,2%
set feb=28
set /a r1=!y!%%4
set /a r2=!y!%%100
if %y:~3,1% equ 0 (
if !r1! equ 0 (
if !r2! equ 0 set feb=29
)
) else (
if !r1! equ 0 (
if not !r2! equ 0 set feb=29
)
)
set /a n=1
for %%a in (31,!feb!,31,30,31,30,31,31,30,31,30,31) do (
if !m! equ !n! (
if not !d! leq %%a (
echo Error:In the month !m! of the year !y!,there must be %%a days at most.
goto :birth
)
)
set /a n+=1
)
goto :sex
:sex
echo Please choose the sex by inputting the index,like 1:
echo 1.Male 2.Female
set /p sex=
call :chkchoice %sex% sex
if not !sex! equ 1 (if not !sex! equ 2 (call :w sex 1 2 sex))
:main
set /a s=!sex!%%2
set c1=!AddCode!!BirthCode!
set /a n=0
set /a sum=0
for %%a in (7 9 10 5 8 4 2 1 6 3 7 9 10 5) do (
call set one=%%c1:~!n!,1%%
set /a sum=!sum!+%%a*!one!
set /a n+=1
)
copy nul id.txt >nul
echo.
echo Creating ID card numbers...(several dozens seconds)
for /l %%a in (!s!,2,999) do (
call :seq %%a
set id=!c1!!SeqCode!!CheckCode!
echo !id!>>id.txt
)
echo.
echo 500 ID card numbers have been created successfully in id.txt .
start notepad id.txt
goto :eof
:seq
set SeqCode=%1
if !SeqCode! lss 100 (if !SeqCode! gtr 9 (set SeqCode=0!SeqCode!& goto :check))
if !SeqCode! lss 10 set SeqCode=00!SeqCode!
:check
set /a n=0
set /a sum2=!sum!
for %%a in (8 4 2) do (
call set one=%%SeqCode:~!n!,1%%
set /a sum2=!sum2!+%%a*!one!
set /a n+=1
)
set /a r=!sum2!%%11
set /a n=0
for %%a in (1 0 X 9 8 7 6 5 4 3 2) do (
if !r! equ !n! (set CheckCode=%%a && goto :eof)
set /a n+=1
)
goto :eof
:chkchoice
set str=%1
if not "%str:~1,1%" equ "" (
if "%str:~1,1%" equ "." (
echo . is unnecessary.
echo e.g.:
echo If you would like to choose the second one,inputting 2 is just ok.
goto :%2
)
)
goto :eof
:w
echo Error:The value of %1 is allowed in [%2,%3] only. && goto :%4
goto :eof
110000 北京市
110100 市辖区
110101 东城区
110102 西城区
110103 崇文区
110104 宣武区
110105 朝阳区
110106 丰台区
110107 石景山区
110108 海淀区
110109 门头沟区
110111 房山区
110112 通州区
110113 顺义区
110114 昌平区
110115 大兴区
110116 怀柔区
110117 平谷区
110200 县
110228 密云县
110229 延庆县 [ Last edited by s11ss on 2007-9-20 at 04:25 PM ]
|