[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文件操作] 一个多行命令的TXT,批处理怎么间隔时间或者等待上个完再执行下?

请教各位大侠,一个多行命令的TXT,怎么间隔时间或者等待上个完再执行下

下面是1.txt的内容,要依次来运行每个批处理,因该怎么写合理,这个一起运行肯定要出错,怎么指定间隔时间对每行运行,或者怎么等待判断上一个运行完毕再执行下一个,

D:\qwe\qwe\10123\ru.bat
D:\qwe\qwe\10129\ru.bat
D:\qwe\qwe\10131\ru.bat
D:\qwe\qwe\10135\ru.bat
D:\qwe\qwe\10137\ru.bat
D:\qwe\qwe\10139\ru.bat
D:\qwe\qwe\15001\ru.bat
D:\qwe\qwe\15003\ru.bat
D:\qwe\qwe\15005\ru.bat
D:\qwe\qwe\15007\ru.bat
D:\qwe\qwe\15009\ru.bat
D:\qwe\qwe\15011\ru.bat
D:\qwe\qwe\15013\ru.bat
D:\qwe\qwe\15015\ru.bat
D:\qwe\qwe\15017\ru.bat
D:\qwe\qwe\15019\ru.bat
D:\qwe\qwe\15021\ru.bat
D:\qwe\qwe\15023\ru.bat
D:\qwe\qwe\15025\ru.bat
D:\qwe\qwe\15027\ru.bat
D:\qwe\qwe\15029\ru.bat
D:\qwe\qwe\15031\ru.bat
D:\qwe\qwe\15033\ru.bat
D:\qwe\qwe\15035\ru.bat
D:\qwe\qwe\15037\ru.bat
D:\qwe\qwe\15039\ru.bat
D:\qwe\qwe\17001\ru.bat
D:\qwe\qwe\17003\ru.bat
D:\qwe\qwe\17005\ru.bat
D:\qwe\qwe\17007\ru.bat
D:\qwe\qwe\17009\ru.bat
D:\qwe\qwe\17011\ru.bat
D:\qwe\qwe\17013\ru.bat
D:\qwe\qwe\17015\ru.bat
D:\qwe\qwe\17017\ru.bat
D:\qwe\qwe\17019\ru.bat
D:\qwe\qwe\17021\ru.bat
D:\qwe\qwe\17023\ru.bat
D:\qwe\qwe\17025\ru.bat
D:\qwe\qwe\17027\ru.bat
D:\qwe\qwe\17029\ru.bat
D:\qwe\qwe\17031\ru.bat
D:\qwe\qwe\17033\ru.bat
D:\qwe\qwe\17035\ru.bat
D:\qwe\qwe\17037\ru.bat
D:\qwe\qwe\17039\ru.bat
D:\qwe\qwe\21503\ru.bat
D:\qwe\qwe\21505\ru.bat
D:\qwe\qwe\21509\ru.bat
D:\qwe\qwe\21513\ru.bat
D:\qwe\qwe\21517\ru.bat
D:\qwe\qwe\21523\ru.bat
D:\qwe\qwe\21525\ru.bat
D:\qwe\qwe\21527\ru.bat
D:\qwe\qwe\21531\ru.bat
D:\qwe\qwe\21535\ru.bat
D:\qwe\qwe\21539\ru.bat
D:\qwe\qwe\21541\ru.bat
D:\qwe\qwe\21547\ru.bat
D:\qwe\qwe\21549\ru.bat
D:\qwe\qwe\21551\ru.bat
D:\qwe\qwe\21553\ru.bat
D:\qwe\qwe\21557\ru.bat
D:\qwe\qwe\21559\ru.bat
D:\qwe\qwe\31001\ru.bat
D:\qwe\qwe\31003\ru.bat
D:\qwe\qwe\31005\ru.bat
D:\qwe\qwe\31007\ru.bat
D:\qwe\qwe\31009\ru.bat
D:\qwe\qwe\31011\ru.bat
D:\qwe\qwe\31013\ru.bat
D:\qwe\qwe\31015\ru.bat
D:\qwe\qwe\31017\ru.bat
D:\qwe\qwe\31019\ru.bat
D:\qwe\qwe\31021\ru.bat
D:\qwe\qwe\31023\ru.bat
D:\qwe\qwe\31025\ru.bat
D:\qwe\qwe\31027\ru.bat
D:\qwe\qwe\31029\ru.bat
D:\qwe\qwe\31031\ru.bat
D:\qwe\qwe\31033\ru.bat
D:\qwe\qwe\31035\ru.bat
D:\qwe\qwe\31037\ru.bat
D:\qwe\qwe\31039\ru.bat
D:\qwe\qwe\31041\ru.bat
D:\qwe\qwe\31043\ru.bat
D:\qwe\qwe\31045\ru.bat
D:\qwe\qwe\31047\ru.bat
D:\qwe\qwe\31049\ru.bat
D:\qwe\qwe\31051\ru.bat
D:\qwe\qwe\31053\ru.bat
D:\qwe\qwe\31055\ru.bat
D:\qwe\qwe\31057\ru.bat
D:\qwe\qwe\31059\ru.bat
D:\qwe\qwe\42001\ru.bat
D:\qwe\qwe\42003\ru.bat
D:\qwe\qwe\42005\ru.bat
D:\qwe\qwe\42007\ru.bat
D:\qwe\qwe\42009\ru.bat
D:\qwe\qwe\42011\ru.bat
D:\qwe\qwe\42013\ru.bat
D:\qwe\qwe\42015\ru.bat
D:\qwe\qwe\42017\ru.bat
D:\qwe\qwe\42019\ru.bat
D:\qwe\qwe\42021\ru.bat
D:\qwe\qwe\42023\ru.bat
D:\qwe\qwe\42025\ru.bat
D:\qwe\qwe\42027\ru.bat
D:\qwe\qwe\42029\ru.bat
D:\qwe\qwe\42031\ru.bat
D:\qwe\qwe\42033\ru.bat
D:\qwe\qwe\42035\ru.bat
D:\qwe\qwe\42037\ru.bat


ru.bat的内容

@echo off
@sc create "xxx都不一样的" binpath= "%~dp0qqq.exe" type= own type= interact start= auto
@sc config "xxx都不一样的" DisplayName= "xxx都不一样的"
@sc description xxx都不一样的 "edfvdg, dfgsdgdfh."
@net start "xxx都不一样的"





下面是1.txt的内容,要依次来运行每个批处理,因该怎么写合理,这个一起运行肯定要出错,怎么指定间隔时间对每行运行,或者怎么等待判断上一个运行完毕再执行下一个,

    怎么一次执行才合理    请大家建议下  写出例子

综合楼上两位的建议:
  1. @echo off
  2. for /f "delims=" %%i in (1.txt) do (
  3.     start /wait "" "%%i"
  4. )
复制代码

TOP

为什么不尝试一下start /wait ?
#&cls&@powershell "Invoke-Expression ([Io.File]::ReadAllText('%~0',[Text.Encoding]::UTF8))" &pause&exit

TOP

  1. @echo off
  2. for /f "delims=" %%i in (1.txt) do (
  3.     start "" "%%i"
  4.     echo 正在延时,请稍后...
  5.     ping -n 10 127.1 >nul
  6. )
复制代码

TOP

返回列表