CODE: [Copy to clipboard]
::用法:在%1给出bat文件名
@echo off
set "tit=[批处理自动测试器] "
set ece=%tit%
set tg=
set file=
popd&title %tit%请给出文件名,支持拖放
if "%~x1" neq ".bat" (set/p file=%tg%输入要编辑的批处理文件名:) else (goto :begin)
:agin
if not defined file goto :eof
if /i "%file:~-4%" neq ".bat" set file=%file%.bat
%0 %file%
:begin
echo;
pushd "%~dp1"
if not exist %1 (echo @echo off^&setlocal enabledelayedexpansion>%1)
set ran=%random%
echo. >%temp%\bat.bat%ran%
start /b cmd.exe /c notepad.exe %1^&del %temp%\bat.bat%ran%
title %tit%当前文件:%1
:loop
set "att=%~a1"
if "%att:a=%" neq "%att%" (
set/p=%tg%[%time:~,-3%] 运行"%1"<nul
echo;&echo;
start /i cmd.exe /k "%1" ^&pause^&exit
attrib "%1" -a
) else (ping -n 2 127.1 >nul)
if not exist %temp%\bat.bat%ran% %0
set/p=%tg% %ece%<nul
set ece=%ece:~1%%ece:~0,1%
goto :loop
[