ksla 当前离线
一级士官
ygqiang 当前离线
少尉
TOP
@echo off :3 :: 运行a.bat call "a.bat" :: 判断运行a.bat之后是否生成1.txt,生成则运行goto 2,不生成则运行goto 1 if exist 1.txt ( goto 2 ) else ( if not exist 1.txt goto 1 ) ::不生成直接退出 :1 exit goto 1 ::生成则重新运行此代码 :2 goto 3复制代码
@echo off :: 运行a.bat call "a.bat" :: 判断运行a.bat之后是否生成1.txt,生成则运行goto 1,不生成则运行goto 2 if exist 1.txt ( goto 1 ) else ( if not exist 1.txt goto 2 ) ::生成则重新运行此代码 :1 call "判断文件是否存在.bat" goto 1 ::不生成直接退出 :2 exit goto 2复制代码
@echo on if exist a.bat ( :next echo exist a.bat start "" a.bat pause if exist 1.txt (echo exist 1.txt && pause && goto :next) echo not exist 1.txt pause exit ) echo not exist a.bat pause exit复制代码
评分人数
@echo off if exist a.bat ( :next start "" a.bat if exist 1.txt (goto :next) exit )复制代码