不行呀,第一个方案还不行,还是十四楼的测试代码,转换后的代码如下:- (
- echo ::=====================================================
- echo :: code by freeants CMD@XP version:1.00
- echo ::=====================================================
- echo @echo off
- echo cd/d "%~dp0">nul
- echo if "%~z1" equ "" goto:usage
- echo if %~z1 gtr 65280 goto:NOT_SUPPORT
- echo setlocal ENABLEDELAYEDEXPANSION
- echo copy/b "%~1" $$$>nul
- echo set/a D_NUM=%~z1+255
- echo call:DEC_HEX %D_NUM% >nul
- echo echo @echo off>"%~n1.cmd"
- echo echo more +5 "%%~0"^|debug^&graftabl 936^>nul>>"%~n1.cmd"
- echo echo copy/b/y $tmp$ "%~nx1"^>nul>>"%~n1.cmd"
- echo echo del/a/f/q $tmp$>>"%~n1.cmd"
- echo echo goto:eof>>"%~n1.cmd"
- echo for /f "eol=- skip=1 tokens=*" %%i in ('^(echo d100,%FILE_SIZE%^&echo q^)^|debug $$$^&^&del $$$') do (
- echo set op=%%i
- echo set op=-=
- echo echo e~5,53 2>nul>>"%~n1.cmd"
- echo )
- echo echo rcx>>"%~n1.cmd"
- echo call:DEC_HEX %~z1 >nul
- echo echo %FILE_SIZE%>>"%~n1.cmd"
- echo echo n$tmp$>>"%~n1.cmd"
- echo echo w>>"%~n1.cmd"
- echo echo q>>"%~n1.cmd"
- echo goto :EOF
- echo :DEC_HEX
- echo set FILE_SIZE=
- echo set PATTERN=123456789ABCDEF
- echo set dec=%1
- echo :WHILE
- echo set /a res=%dec%%%16-1
- echo set /a dec/=16
- echo set res=~%res%,1
- echo set FILE_SIZE=%res%%FILE_SIZE%
- echo if "%dec%" neq "0" goto WHILE
- echo goto:eof
- echo :usage
- echo echo.================================================
- echo echo 你没有指定要处理的文件或指定的文件不存在……
- echo echo.
- echo echo 用法:
- echo echo %~n0 fileName
- echo echo.================================================
- echo goto:eof
- echo :NOT_SUPPORT
- echo echo 指定的文件过大,脚本(%~nx0)不能处理……
- echo pause
- echo goto:eof
- )>a.bat
复制代码 运行后还是无法生成a.bat |