保存到 “jzt_.bat” (扔到Path目录复制代码
- @Echo off
- setlocal enabledelayedexpansion
- REM Made By:Bbaa
- set "space= "
- If "%~1"=="" (
- For %%i in (
- ""
- "文字金字塔无聊之作"
- "jzt_ <text> [English/Chinese](全中文还是汉字) [/q] 不显示过程 [/r 自动调整窗口]"
- ) do Echo;%%~i
- exit /b
- )
- :Begin
- Rem =================检测部分=================
- set WZ=
- set "Text=%~1"
- If /i "%~2"=="English" set WZ=English
- If /i "%~2"=="Chinese" set WZ=Chinese
- If /i "%~2"=="/q" set xs=Rem
- If /i "%~3"=="/q" set xs=Rem
- If /i "%~4"=="/q" set xs=Rem
- If /i "%~2"=="/r" set "Tz=call :TZCK"
- If /i "%~3"=="/r" set "Tz=call :TZCK"
- If /i "%~3"=="/r" set "Tz=call :TZCK"
- If /i "%~4"=="/r" set "Tz=call :TZCK"
- call :Zspd !Text!
- set zjs=%errorlevel%
- if defined WZ (
- if "!WZ!"=="English" (Goto Jzt_Pd_yw)
- if "!WZ!"=="Chinese" (Goto Jzt_js)
- ) else (
- Goto Jzt_Pd
- Goto :EOF
- )
- Exit /b
- :Jzt_Pd
- %Xs% Title =================检测文字是否为纯中英文=================
- set AlphaBet=ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789
- set gxr=1
- set "Text_tmp=!Text!"
- :Jzt_Pd_Loop1
- %Xs% Title =================检测文字是否为纯中英文-过程1=================
- If Not "!Text_tmp!"=="" (
- Set "Text_tmp_1=!Text_tmp:~0,1!"
- Set "Text_tmp=!Text_tmp:~1!"
- set r=0
- Set "AlphaBet_tmp=!AlphaBet!"
- call :Jzt_Pd_Pd1 !Text_tmp_1!
- set /a gxr+=1
- if !r!==0 (if defined dp (set dp=!dp!2) else set dp=2)
- Goto Jzt_Pd_Loop1
- )
- Goto Jzt_Pd_ZYF
- :Jzt_Pd_Pd1
- %Xs% Title =================检测文字是否为纯中英文-过程!gxr!\!zjs!-判断!AlphaBet_tmp!=================
- set tre=%~1
- If Not "!AlphaBet_tmp!"=="" (
- set "AlphaBet_tmp_1=!AlphaBet_tmp:~0,1!"
- Set "AlphaBet_tmp=!AlphaBet_tmp:~1!"
- If /i "!tre!"=="!AlphaBet_tmp_1!" (Call :Jzt_yw)
- GOTO :Jzt_Pd_Pd1
- )
- Goto :Eof
- :Jzt_yw
- set r=1
- if defined dp (set dp=!dp!1) else set dp=1
- GOto :Eof
- :Jzt_Pd_ZYF
- %Xs% Title =================中英文验证=================
- set Jzt_Pd_y=!dp:~0,1!
- if !Jzt_PD_y!==1 Goto Jzt_Pd_ZYF_y
- if !Jzt_PD_y!==2 Goto Jzt_Pd_ZYF_z
- exit /b
- :Jzt_Pd_ZYF_y
- if not "!dp!"=="" (
- set dp_1=!dp:~0,1!
- set dp=!dp:~1!
- if !dp_1!==2 (Call :Error 非纯中英文&exit/b)
- Goto :Jzt_Pd_ZYF_y
- )
- set WZ=English
- Goto Jzt_Pd_Yw
- :Jzt_Pd_ZYF_z
- if not "!dp!"=="" (
- set dp_1=!dp:~0,1!
- set dp=!dp:~1!
- if !dp_1!==1 (Call :Error 非纯中英文&exit /b)
- Goto :Jzt_Pd_ZYF_z
- )
- set WZ=Chinese
- Goto Jzt_js
- :Jzt_js
- set "Text_tmp=!Text!"
- set jzt_jsq=0
- :Jzt_js.loop
- %Xs% Title =================中文奇数验证=================
- If Not "!Text_tmp!"=="" (
- set /a Jzt_jsq+=1
- Set "Text_tmp=!Text_tmp:~1!"
- Goto :Jzt_js.loop
- )
- if not !Jzt_jsq! gtr 1 (call :Error 中文数量必须大于1&exit/b)
- set /a Jzt_erPd=!Jzt_jsq!%%2
- Rem echo !Jzt_erPd!;!Jzt_jsq!
- if not !Jzt_erPd!==1 (Call :Error 中文数量必须为奇数&exit/b)
- Goto Jzt_PB
- :Jzt_Pd_Yw
- %Xs% Title =================英文字数验证=================
- set "Text_tmp=!Text!"
- :Jzt_Pd_Yw_loop
- If Not "!Text_tmp!"=="" (
- set /a Jzt_jsq+=1
- Set "Text_tmp=!Text_tmp:~1!"
- Goto :Jzt_Pd_Yw_loop
- )
- set /a Jzt_erPd=!Jzt_jsq!%%2
- if !Jzt_erPd!==0 (set jw=2) else set jw=1
- goto Jzt_PB
- :jzt_PB
- %Xs% Title =================中文英文再次验证=================
- if "!WZ!"=="English" (Goto Jzt_PB_yw)
- if "!WZ!"=="Chinese" (Goto Jzt_PB_ZW)
- Exit /b
- :Jzt_PB_ZW
- %Tz%
- set "Text_tmp=!Text!"
- set /a line=!zjs!/2
- :Jzt_PB_ZW_Tj
- Set JSRR=1
- %xs% Title 生成中 进度 !JSRR!/!line!
- set "Text_tmp_1=!Text_tmp!"
- :JZT_SC_ZW
- Call :ZSPD !Text_tmp!
- Set zjs=!Errorlevel!
- Set zjst=!Errorlevel!
- Set HXS=1
- Rem echo !zjs!
- Set /a ZZS=!zjs!/2*2
- :JZT_SC_ZW_1
- Rem 过程1
- Set "Text_tmp_1=!Text_tmp:~%ZZS%,%HXS%!"
- Set /a JSRR+=1
- %xs% Title 生成中 进度 !JSRR!/!line!
- Call :Jzt_PB_ZW_Tj_CL
- Set /a ZZS-=2
- Set /a HXS+=2
- If Not !ZZS! Leq 0 (Goto :JZT_SC_ZW_1) else (Echo !Text_tmp!)
- Goto :Eof
- :Jzt_PB_ZW_Tj_CL
- set /a sp=%zzs%
- echo !SPACE:~-%sp%!!Text_tmp_1!
- Goto :EOF
- :Jzt_PB_yw
- echo 暂不支持英文
- Goto :Eof
- :Error
- set /a sd=%random%%%9999+1000
- set /a sd1=%random%%%99+10
- Echo;Error:0x!sd!!sd1! %~1
- exit /b
- :Zspd
- set "ZSPD_TMP=%~1"
- set zspd=
- :ZSPD_TMP
- If Not "!ZSPD_TMP!"=="" (
- set /a ZSPD+=1
- Set "ZSPD_tmp=!ZSPD_tmp:~1!"
- Goto :ZSPD_TMP
- )
- set errorlevel=!Zspd!
- Goto :eof
- :TZCK
- if "!WZ!"=="Chinese" (Goto :TZCK_Chinese)
- Goto :Eof
- :TZCK_Chinese
- cls
- set /a line=!zjs!/2+8
- set /a cols=!zjs!*2
- mode con lines=%line% cols=!cols!
- Goto :Eof
欢迎光临 批处理之家 (http://www.bathome.net/) | Powered by Discuz! 7.2 |