源代码: | @echo off | | :: ax = b8h | | :: bx = bbh | | :: cx = b9h | | :: dx = bah | | :: sp = bch | | :: bp = bdh | | :: si = beh | | :: di = bfh | | | | set dq=" | | set excla=! | | | | goto :length | | | | :main | | echo e 0100 b8 00 13 bb %1 00 b9 %hex% ba %y% %x% bd 16 01 cd >1.txt | | echo e 0110 10 b8 00 4c cd 21 >>1.txt | | (echo rcx & echo 16 & echo n temp & echo w & echo q) >>1.txt | | debug<1.txt>nul | | echo[!str!>>echoing | | copy /b temp+echoing writing.com >nul | | del 1.txt | | del TEMP | | del echoing | | del $ | | writing | | del writing.com | | goto :eof | | | | :hexconvert | | set hexstring=0123456789abcdef | | set /a h3=(strlen^>^>12)^&15 | | set /a h2=(strlen^>^>8)^&15 | | set /a h1=(strlen^>^>4)^&15 | | set /a h0=(strlen^>^>0)^&15 | | set hex=!hexstring:~%h1%,1!!hexstring:~%h0%,1! !hexstring:~%h3%,1!!hexstring:~%h2%,1! | | set /a h3=(x^>^>4)^&15 | | set /a h2=(x^>^>0)^&15 | | set /a h1=(y^>^>4)^&15 | | set /a h0=(y^>^>0)^&15 | | set x=!hexstring:~%h1%,1!!hexstring:~%h0%,1! | | set y=!hexstring:~%h3%,1!!hexstring:~%h2%,1! | | goto main | | | | :length | | set x=%2 | | set y=%3 | | set str=%4 | | | | | | setlocal enabledelayedexpansion | | | | if not "!str:~0,1!" == "!dq!" goto returning | | set str=!str:""=^"! & rem 反向转义 | | set str=!str:~1,-2! & rem 删除引号 | | :returning | | echo[!str!>$ | | for /f %%@ in ("$") do set/a strlen=%%~z@-2 | | goto hexconvertCOPY |
|