:: Seterror.bat - Third version
:: 这是汇编程序的改进版,加入了进制转换代码,可以使用十进制参数了
:: 对于非法的参数处理:
:: 22e-->22 e22-->0 256-->0 65535-->255 65536-->0
@echo off
if == goto end
if exist seterror.com goto run
if exist seterror.asd goto debug
:setscript
echo >seterror.asd A100
echo>>seterror.asd MOV SI,0082
echo>>seterror.asd XOR AX,AX
echo>>seterror.asd XOR BX,BX
echo>>seterror.asd MOV CX,000A
echo>>seterror.asd MOV BL,
echo>>seterror.asd CMP BL,30
echo>>seterror.asd JL 0120
echo>>seterror.asd CMP BL,39
echo>>seterror.asd JG 0120
echo>>seterror.asd SUB BL,30
echo>>seterror.asd MUL CX
echo>>seterror.asd ADD AX,BX
echo>>seterror.asd INC SI
echo>>seterror.asd JMP 010A
echo>>seterror.asd MOV AH,4C
echo>>seterror.asd INT 21
echo.>>seterror.asd
echo>>seterror.asd R CX
echo>>seterror.asd 24
echo>>seterror.asd W
echo>>seterror.asd Q
:debug
debug SETERROR.COM nul
:run
seterror.com %1
if not errorlevel %1 goto error
if not == if errorlevel %1 echo Current errorlevel is set.
if exist geterror.bat call geterror.bat %3
::if exist seterror.com del seterror.com
::if exist seterror.asd del seterror.asd
goto end
:error
echo.
echo Error: Fail to set current errorlevel.
echo.
goto end
:end
※ Batchinger 致 Bat Fans:请访问
批处理编程的异类 ,欢迎交流与共享批处理编程心得!