需要SD.bat脚本库支持:
-
- @ECHO Off&SETLOCAL ENABLEDELAYEDEXPANSION
- SET SYBNV=0.0.1
- IF "%1" == "" GOTO SYBN
- SET SYBCOM=A100;E8A 80 CD89 C581 81 F980 7F06 CD09 8016 1F9 687F 64EB 83BE E800 65 5AE3 73E8;3C00 7F18 8853 E8C6 57 4CE3 65E8 3C00 7F4F 8845 B0C2 F602 50E2 A0B0 E6F6 15F;E8C7 3D 32E3 C387 393C 27E 904 FB80 7E39 8003 9C3 F24 E380 C00F 4E0 D808;B850 B800 750 295A 89F5 EBE9 AC46 ACAC ACAC F7E2 4CB4 21CD FAEB E088 4CB4;21CD ACAC 203C 475 F9E2 9EB C388 3CAC 7520 E202 C3F9 C387 302C EB80 B430;F60A E4 C3D8 5953 4E42 DED0 C4B8 3032 3930 3231 3631 AC24 243C A74 88AA AAD0;F5E2 B4EB B2EB E349 49AF ACE3 B6E8 E3FF 87A7 3CC3 7E39 402 8009 39FB 37E;C380 2409 800F FE3 10B2 E2F6 D800 C288 C7E2 86EB
- SET SYBM=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
- :SYDLL
- CALL :SYB%* 2>NUL
- EXIT /B %ERRORLEVEL%
- :SYBA
- (CHCP 437 &GRAFTABL 936)>NUL
- ECHO {SYBN DLL %SYBNV% } 初始化,按任意键继续...
- SET W=00
- (echo a100&echo db B8 00 00 cd 16 cd 20&echo.&echo.rcx&echo.7&echo.g&echo.q)|DEBUG>NUL
- GOTO :EOF
- :SYBB
- set deb= 20 f0^&echo.f B800:
- (echo.fb800:0 9f 20 f0&echo.fb800:9e a1%deb%13e 141%deb%1de 1e1%deb%27e 271%deb%31e 321%deb%3be 3e1%deb%45e 461%deb%4fe 501%deb%59e 5a1%deb%63e 641%deb%6de 6e1%deb%77e 781%deb%81e 821%deb%8be 8c1%deb%95e 961%deb%9fe a01%deb%a9e aa1%deb%b3e b41%deb%bde be1%deb%c7e c81%deb%d1e d21%deb%bde be1%deb%e5e r61%deb%efe f01%deb%f9e fae20 f0 20 f0&echo q)|debug
- GOTO :EOF
- :SYBC
- IF "%1" == "" SET SYBCC=&GOTO SYBCC
- set SYBCC=%*
- IF %1 LSS 25 (IF %1 GTR -1 SET /A SYBCC=10000+%1*100+%2*2&&SET SYBCC=!SYBCC!%3%4%5%6) else (IF %1 GTR 10000 IF %1 LSS SYBCC SET SYBCC=%*)
- :SYBCC
- if "%SYBCC%" == "" set SYBCC=%*
- IF "%SYBCMS%" == "1" (if not exist sybc.com call :sybcj)&&SYBC %SYBCC%&&GOTO :EOF
- if not "%sybcs%" == "" set w=%sybcs%&&goto :sybcg
- CALL :SYBL %SYBCC%
- set /a err=%ERRORLEVEL%+1
- if %ERR% lss 3 set err=0
- FOR /F "delims=~" %%A IN ('CALL SD M %err% 10 16') DO SET W=%%A
- FOR /F "delims=~" %%A IN ('CALL SD W 2 00%W% 2') DO SET W=%%A
- :set SYBCC=%SYBCC:_= %
- :echo ;DB %W% 0D "%SYBCC%" >>sd.txt
- :sybcg
- SET V=;A80;DB %W% 0D "%SYBCC%" 0D;;RCX;F0;G;Q
- (ECHO.%SYBCOM:;=&ECHO.DW %&ECHO.%V:;=&ECHO.%)|DEBUG>NUL
- EXIT /B %ERRORLEVEL%
- :sybcz
- SET V=;AB800:%1;%2 %3 0D %4 0D;;RCX;F0;G;Q
- (ECHO.%SYBCOM:;=&ECHO.DW %&ECHO.%V:;=&ECHO.%)|DEBUG>NUL
- EXIT /B %ERRORLEVEL%
- :SYBCJ
- SET V=;RCX;F0;N SYBC.COM;W;Q
- (ECHO.%SYBCOM:;=&ECHO.DW %&ECHO.%V:;=&ECHO.%)|DEBUG>NUL
- GOTO :EOF
- :SYBD
- set sybd1=%1
- set sybd2=%2
- set sybd3=%3
- if "%1" == "" (set sybd1=0)
- if "%2" == "" (set sybd2=fa0)
- if "%3" == "" (set sybd3=a0)
- (echo m b800:%sybd1% %sybd2% b800:%sybd3%&echo q)|debug >nul
- GOTO :EOF
- :SYBE
- (echo m b800:0 fa0 b800:a0&echo q)|debug >nul
- GOTO :EOF
- :SYBF
- SET SYBK=SYBK1=┌─┐│└┘┼;SYBK2=┏━┓┃┗┛╋;SYBK3=╔═╗║╚╝╬
- SET %SYBK:;=&SET %
- set b=
- set BKBK=
- set /a BKQ=%1,SYBK=%2,BKH=%3,BKX=%1
- if %2 lss 2 (
- for /l %%B in (1,1,%3) do set b=!b!!SYBK%5:~1,1!
- sybc %BKQ%%4!b!
- goto :eof)
- if %3 lss 2 (set /a BKX-=100&&for /l %%B in (1,1,%2) do (
- set /a BKX+=100&&sybc !BKX!%4!SYBK%5:~3,1!)
- goto :eof)
- for /l %%B in (3,1,%SYBK%) do set b=!b!!SYBK%5:~1,1!&&set BKBK=!BKBK!
- sybc %BKQ%%4!SYBK%5:~0,1!%b%!SYBK%5:~2,1!
- for /l %%B in (3,1,%BKH%) do set /a BKX=BKX+100&&sybc !BKX!%4!SYBK%5:~3,1!%BKBK%!SYBK%5:~3,1!
- set /a BKX=BKX+100
- sybc %BKX%%4!SYBK%5:~4,1!%b%!SYBK%5:~5,1!
- goto :eof
- :SYBG
- :SYBH
- :SYBI
- GOTO :EOF
- :SYBK
- SET A=IN72=1;80=2;75=3;77=4;57=5;28=6;59=7;2=31
- SET %A:;=&SET IN%
- CALL :SYBC %1
- EXIT /B 1!IN%ERRORLEVEL%!
- :SYBL
- IF "%*" == "" EXIT /B 0
- SET L=%*
- SET L=%L:"=.%
- if "%L:~64,1%" == "" (set m=) else (m=%L:~64,62%)
- set a=0
- SET e= == 0D set /a a=
- SET F=^&^&GOTO :SYBL2
- FOR /F "SKIP=4 TOKENS=2-16" %%A IN ('^(ECHO.A100^&ECHO.DB "%L%" 0D^&ECHO.DB "%M%" 0D^&ECHO.^&ECHO.D100^&ECHO.D^&ECHO.Q^)^|DEBUG') DO if not "%%O" == "" set h=%%H&&SET c=!H:~0,2!&&SET D=!H:~-2!&&(if %%A%E%!a!+0%F%)&&(if %%B%E%!a!+1%F%)&&(if %%C%E%!a!+2%F%)&&(if %%D%E%!a!+3%F%)&&(if %%E%E%!a!+4%F%)&&(if %%F%E%!a!+5%F%)&&(if %%G%E%!a!+6%F%)&&(if !C!%E%!a!+7%F%)&&(if !D!%E%!a!+8%F%)&&(if %%I%E%!a!+9%F%)&&(if %%J%E%!a!+10%F%)&&(if %%K%E%!a!+11%F%)&&(if %%L%E%!a!+12%F%)&&(if %%M%E%!a!+13%F%)&&(if %%N%E%!a!+14%F%)&&(if %%O%E%!a!+15%F%)&&set /a a=!a!+16
- EXIT /B 72
- :SYBL2
- EXIT /B %A%
- :SYBLE
- IF "%*" == "" EXIT /B 0
- SET L=%*
- SET /A M=128,N=0,K=32
- :SYBLO
- SET /A O=K
- IF "!L:~%K%,1!" == "" (SET /A M=K,K=K/2+N/2) ELSE (SET /A N=K,K=M/2+K/2)
- IF %O% == %K% SET /A L=K+1&&EXIT /B !L!
- GOTO SYBLO
- :SYBM
- IF "%1" == "" EXIT /B 0
- IF %1 == 0 EXIT /B 0
- SET S=%1$&SET T=%2&SET U=%3
- IF "%2" == "" SET T=10
- IF "%3" == "" SET U=16
- FOR /L %%A IN (0,1,35) DO SET SYBM%%A=!SYBM:~%%A,1!&&SET SYBM!SYBM:~%%A,1!=%%A
- SET Z=0
- IF %T% GTR 36 IF %T% GTR A (SET /A T=!SYBM%T%!+1) ELSE (SET T=36)
- IF %T% LSS 2 SET T=10
- :SYBM1
- SET R=%S:~0,1%
- SET S=%S:~1,999%
- SET L=!SYBM%R%!
- SET /A Z=Z*T+L
- IF NOT "%S:~0,1%" == "$" GOTO SYBM1
- SET S=
- IF "%U%" GTR "A" SET /A U=!SYBM%U%!+1
- :SYBM2
- SET /A R=Z,Y=Z%%U,Z=(Z-Y)/U
- IF NOT %Z% == %R% SET S=!SYBM%Y%!!S!&GOTO SYBM2
- IF not "%u%" == "10" ECHO.%S%
- EXIT /B %S%
- :SYBN
- ECHO OFF&COLOR 3E
- ECHO {SYBN DLL 脚本公共库 V %SYBNV%} [开发中...]
- ECHO.
- ECHO 请使用 "CALL SD 命令 参数" 的形式调用,命令列表如下:
- ECHO.
- ECHO A 为SYBC及依赖SYBC的模块初始化显示模式
- ECHO C 调用SYBC
- ECHO CJ创建SYBC.COM
- ECHO F 调用SYBC.COM画方框 [起始位置][宽][高][颜色][样式]
- ECHO K 调用SYBC获取按键 [A 返回字符内码;空 返回键盘码]{返回ERRORLEVEL}
- ECHO L 求中文字符长度 [被计算字符(短于71B的中英文)]{返回ERRORLEVEL}
- ECHO LE求英文字符长度 [被计算字符(非中文,不限长度)]{返回ERRORLEVEL}
- ECHO M 进制转换[被转换值][被转换的进制][返回值的进制]{返回ERRORLEVEL或ECHO}
- ECHO N 帮助信息
- ECHO T 求两个时间差 [起始时间][终止时间][反回时间单位(H/M/S/T)]{返回ERRORLEVEL}
- ECHO TC求命令运行时间 [命令]{返回ERRORLEVEL并echo}
- ECHO W 调整字符长度 [长度][被调整字符][对齐方式(1=左;2=右)][补位符]{结果ECHO}
- ECHO.
- CALL SD T 5:00:00.00 %TIME% S
- ECHO 示例1:"CALL SD T 5:00:00.00 %%TIME%% S"求5点过去多少分钟了,返回ERRORLEVEL=%ERRORLEVEL%
- CALL SD LE %ERRORLEVEL%
- ECHO 示例2:"CALL SD LE %%ERRORLEVEL%%" 求分钟数的字符长度, 返回ERRORLEVEL=%ERRORLEVEL%
- CALL SD M %ERRORLEVEL% 10 2 >nul
- ECHO 示例3:"CALL SD M %%ERRORLEVEL%% 10 2" 求字符长度的2进制值,返回ERRORLEVEL=%ERRORLEVEL%
- PAUSE
- GOTO :EOF
- :SYBO
- SET SYBK=SYBK1=┌─┐│└┘┼;SYBK2=┏━┓┃┗┛╋;SYBK3=╔═╗║╚╝╬
- SET %SYBK:;=&SET %
- SET B=
- SET SYBKK=
- SET /A BKQ=%1,BKL=%2,BKH=%3,BKX=%1,BKK=%2*2-4,Y=%5
- IF "%Y%" == "" SET Y=2
- IF %2 LSS 2 (
- FOR /L %%B IN (1,1,%3) DO SET B=!B!!SYBK%Y%:~1,1!
- call :sybc %BKQ%%4!B!
- GOTO :EOF)
- IF %3 LSS 2 (SET /A BKX-=100&&FOR /L %%B IN (1,1,%2) DO (
- SET /A BKX+=100&&call :SYBC !BKX!%4!SYBK%Y%:~3,1!)
- GOTO :EOF)
- FOR /L %%B IN (3,1,%BKL%) DO SET B=!B!!SYBK%Y%:~1,1!&&SET SYBKK=!SYBKK!
- call :SYBC %BKQ%%4!SYBK%Y%:~0,1!%B%!SYBK%Y%:~2,1!
- if "%6" == "" (set SYBKZ3=%SYBKK%) else FOR /F "delims=~" %%A IN ('CALL SD W %BKK% "%6" 1') DO SET SYBKZ3=%%A
- if "%7" == "" (set SYBKZ4=%SYBKK%) else FOR /F "delims=~" %%A IN ('CALL SD W %BKK% "%7" 1') DO SET SYBKZ4=%%A
- if "%8" == "" (set SYBKZ5=%SYBKK%) else FOR /F "delims=~" %%A IN ('CALL SD W %BKK% "%8" 1') DO SET SYBKZ5=%%A
- if "%9" == "" (set SYBKZ6=%SYBKK%) else FOR /F "delims=~" %%A IN ('CALL SD W %BKK% "%9" 1') DO SET SYBKZ6=%%A
- FOR /L %%B IN (7,1,%BKH%) DO SET SYBKZ%%B=!SYBKK!
- FOR /L %%B IN (3,1,%BKH%) DO SET /A BKX=BKX+100&&call :SYBC !BKX!%4!SYBK%Y%:~3,1!!SYBKZ%%B!!SYBK%Y%:~3,1!&&PAUSE>NUL
- SET /A BKX=BKX+100
- call :SYBC %BKX%%4!SYBK%Y%:~4,1!%B%!SYBK%Y%:~5,1!
- GOTO :EOF
- :SYBP
- set a=0
- SET e= == 0D set /a a=
- SET F=^&^&GOTO :SYBQ
- FOR /F "SKIP=4 TOKENS=2-16" %%A IN ('^(ECHO.A100^&ECHO.DB "%1" 0D^&ECHO.^&ECHO.D100^&ECHO.D^&ECHO.Q^)^|DEBUG') DO if not "%%O" == "" set h=%%H&&SET c=!H:~0,2!&&SET D=!H:~-2!&&(if %%A%E%!a!+0%F%)&&(if %%B%E%!a!+1%F%)&&(if %%C%E%!a!+2%F%)&&(if %%D%E%!a!+3%F%)&&(if %%E%E%!a!+4%F%)&&(if %%F%E%!a!+5%F%)&&(if %%G%E%!a!+6%F%)&&(if !C!%E%!a!+7%F%)&&(if !D!%E%!a!+8%F%)&&(if %%I%E%!a!+9%F%)&&(if %%J%E%!a!+10%F%)&&(if %%K%E%!a!+11%F%)&&(if %%L%E%!a!+12%F%)&&(if %%M%E%!a!+13%F%)&&(if %%N%E%!a!+14%F%)&&(if %%O%E%!a!+15%F%)&&set /a a=!a!+16
- goto :eof
- :SYBQ
- EXIT /B %A%
- :SYBR
- :SYBS
- GOTO :EOF
- :SYBT
- IF "%1" == "" EXIT /B 0
- FOR /F "DELIMS=:. TOKENS=1,2,3,4" %%N IN ("%1") DO SET O=1%%O&SET P=1%%P&SET Q=1%%Q&SET /A N=100+%%N
- IF "%2" == "" SET /A T=N*360000+O*6000+P*100+Q-36610100&&EXIT /B !T!
- FOR /F "DELIMS=:. TOKENS=1,2,3,4" %%M IN ("%2") DO SET I=1%%N&SET J=1%%O&SET K=1%%P&SET /A H=100+%%M
- IF "%2" GTR "A" (SET L=%2&SET /A T=N*360000+O*6000+P*100+Q-36610100,S=T/100,M=T/6000,H=T/360000) ELSE (SET L=%3&SET /A H=H-N,I=I-O,J=J-P,K=K-Q,T=H*360000+I*6000+J*100+K,S=T/100,M=T/6000,H=T/360000)
- IF "%L%" == "" SET L=T
- EXIT /B !%L%!
- :SYBTC
- set SYBTC1=%time%
- call %*
- set SYBTC2=%time%
- call :SYBT %SYBTC1% %SYBTC2%
- echo %errorlevel%
- exit /B %errorlevel%
- :SYBU
- :SYBV
- GOTO :EOF
- :SYBW
- IF "%1" == "" SET W=..&GOTO :EOF
- SET W=%2
- SET W=%W:"=%
- if "%SYBW%" == "1" (CALL :SYBLE %w%) else (CALL :SYBL %w%)
- set l=%errorlevel%
- SET /A V=%1-%L%
- SET K=%4
- IF "%2" == "" SET W=
- IF "%4" == "" SET K=
- IF "%4" == "2" SET K=--
- IF %L% == %1 GOTO :EOF
- IF %V% GTR 0 IF "%3" == "1" (FOR /L %%A IN (1,1,%V%) DO SET W=!W!%K%) ELSE (FOR /L %%A IN (1,1,%V%) DO SET W=%K%!W!)
- IF %V% LSS 0 IF "%3" == "1" (SET W=!W:~0,%1!) ELSE (SET W=!W:~-%1!)
- ECHO.%W%
- if "%w:~0,1%" == "C" pause
- GOTO :EOF
- :EXIT /B
- :SYBX
- :SYBY
- :SYBZ
- GOTO :EOF
复制代码
|