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

[文本处理] 有规律的要写到BAT代码块2000

写了个代码,代码块1和代码块2…………等有部分只是改个数字,不会写代码改,我要写到代码块2000,怎么办,手动复制粘贴太慢了太累人了
  1. if not  "%~1"=="p" start /min zmd.exe /c %0 p&exit
  2. @echo off
  3. : lab1
  4. :: 删除testout中零字节ts最好e:\n零字节也删除一下一定要删除零字节因为零字节ts会导致合并视频失败从而导致testtesttest.ts不变大而不断重启下载进程我为这个浪费了好几天才找到原因
  5. :: for /r E:\N\testout %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  6. call  copy  E:\testout\00001.ts E:\testout\test /y
  7. fciv.exa  E:\testout\test\00001.ts -md5>11.txt
  8. :: 等待120秒的原因是如果文件变大则再复制00001.ts其22txt的md5是不一样的fciv不能访问被1exe下载的文件所以要复制
  9. timeout /nobreak /t 120
  10. :: 调用hebing.bat合并视频
  11. call "E:\testout\test\hebing.bat"
  12. call  copy  E:\testout\00001.ts E:\testout\test /y
  13. fciv.exa  E:\testout\test\00001.ts -md5>22.txt
  14. fc.exa /b 11.txt 22.txt > nul
  15. if errorlevel 1 (
  16.     :: 视频变大则跳转至此代码块开头隔120秒再监视是否变大
  17.     goto lab1
  18. ) else (
  19.     :: 视频不变大则启动新下载任务
  20.     taskkill /f /im 1.exe
  21.     taskkill /f /im cmd.exe
  22.     for /r E:\testout\test %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  23.     start cmd /k "1.exe -y -i  [url]http://64.1643.17.9:389/.m3u8[/url] 00002.ts"
  24.    :: 跳转至代码块2 1+1等于2 所以goto 11
  25.     goto lab11
  26. )
  27. :: 我是代码分割线 启动下一个下载任务 代码块1
  28. : lab11
  29. :: 删除testout中零字节ts最好e:\n零字节也删除一下一定要删除零字节因为零字节ts会导致合并视频失败从而导致testtesttest.ts不变大而不断重启下载进程我为这个浪费了好几天才找到原因
  30. :: for /r E:\N\testout %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  31. call  copy  E:\testout\00002.ts E:\testout\test /y
  32. fciv.exa  E:\testout\test\00002.ts -md5>11.txt
  33. timeout /nobreak /t 120
  34. :: 调用hebing.bat合并视频
  35. call "E:\testout\test\hebing.bat"
  36. call  copy  E:\testout\00002.ts E:\testout\test /y
  37. fciv.exa  E:\testout\test\00002.ts -md5>22.txt
  38. fc.exa /b 11.txt 22.txt > nul
  39. if errorlevel 1 (
  40.     :: 视频变大则跳转至此代码块开头隔120秒再监视是否变大
  41.     goto lab11
  42. ) else (
  43.     :: 视频不变大则启动新下载任务
  44.     taskkill /f /im 1.exe
  45.     taskkill /f /im cmd.exe
  46.     for /r E:\testout\test %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  47.     start cmd /k "1.exe -y -i  [url]http://64.1643.17.9:389/.m3u8[/url] 00003.ts"
  48.    :: 跳转至代码块3 1+1+1等于3 所以goto 111
  49.     goto lab111
  50. )
  51. :: 我是代码分割线 启动下一个下载任务 代码块2
  52. : lab111
  53. :: 删除testout中零字节ts最好e:\n零字节也删除一下一定要删除零字节因为零字节ts会导致合并视频失败从而导致testtesttest.ts不变大而不断重启下载进程我为这个浪费了好几天才找到原因
  54. :: for /r E:\N\testout %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  55. call  copy  E:\testout\00003.ts E:\testout\test /y
  56. fciv.exa  E:\testout\test\00003.ts -md5>11.txt
  57. timeout /nobreak /t 120
  58. :: 调用hebing.bat合并视频
  59. call "E:\testout\test\hebing.bat"
  60. call  copy  E:\testout\00003.ts E:\testout\test /y
  61. fciv.exa  E:\testout\test\00003.ts -md5>22.txt
  62. fc.exa /b 11.txt 22.txt > nul
  63. if errorlevel 1 (
  64.     :: 视频变大则跳转至此代码块开头隔120秒再监视是否变大
  65.     goto lab111
  66. ) else (
  67.     :: 视频不变大则启动新下载任务
  68.     taskkill /f /im 1.exe
  69.     taskkill /f /im cmd.exe
  70.     for /r E:\testout\test %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  71.     start cmd /k "1.exe -y -i  [url]http://64.1643.17.9:389/.m3u8[/url] 00004.ts"
  72.     goto lab1111
  73. )
  74. :: 我是代码分割线 启动下一个下载任务 代码块3
  75. : lab1111
  76. :: 删除testout中零字节ts最好e:\n零字节也删除一下一定要删除零字节因为零字节ts会导致合并视频失败从而导致testtesttest.ts不变大而不断重启下载进程我为这个浪费了好几天才找到原因
  77. :: for /r E:\N\testout %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  78. call  copy  E:\testout\00004.ts E:\testout\test /y
  79. fciv.exa  E:\testout\00004.ts -md5>11.txt
  80. timeout /nobreak /t 120
  81. :: 调用hebing.bat合并视频
  82. call "E:\testout\test\hebing.bat"
  83. call  copy  E:\testout\00004.ts E:\testout\test /y
  84. fciv.exa  E:\testout\00004.ts -md5>22.txt
  85. fc.exa /b 11.txt 22.txt > nul
  86. if errorlevel 1 (
  87.     :: 视频变大则跳转至此代码块开头隔120秒再监视是否变大
  88.     goto lab1111
  89. ) else (
  90.     :: 视频不变大则启动新下载任务
  91.     taskkill /f /im 1.exe
  92.     taskkill /f /im cmd.exe
  93.     for /r E:\testout\test %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  94.     start cmd /k "1.exe -y -i  [url]http://64.1643.17.9:389/.m3u8[/url] 00005.ts"
  95.     goto lab11111
  96. )
  97. :: 我是代码分割线 启动下一个下载任务 代码块4
  98. : lab11111
  99. :: 删除testout中零字节ts最好e:\n零字节也删除一下一定要删除零字节因为零字节ts会导致合并视频失败从而导致testtesttest.ts不变大而不断重启下载进程我为这个浪费了好几天才找到原因
  100. :: for /r E:\N\testout %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  101. call  copy  E:\testout\00005.ts E:\testout\test /y
  102. fciv.exa  E:\testout\00005.ts -md5>11.txt
  103. timeout /nobreak /t 120
  104. :: 调用hebing.bat合并视频
  105. call "E:\testout\test\hebing.bat"
  106. call  copy  E:\testout\00005.ts E:\testout\test /y
  107. fciv.exa  E:\testout\00005.ts -md5>22.txt
  108. fc.exa /b 11.txt 22.txt > nul
  109. if errorlevel 1 (
  110.     :: 视频变大则跳转至此代码块开头隔120秒再监视是否变大
  111.     goto lab11111
  112. ) else (
  113.     :: 视频不变大则启动新下载任务
  114.     taskkill /f /im 1.exe
  115.     taskkill /f /im cmd.exe
  116.     for /r E:\testout\test %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  117.     start cmd /k "1.exe -y -i  [url]http://64.1643.17.9:389/.m3u8[/url] 00006.ts"
  118.     goto lab111111
  119. )
  120. :: 我是代码分割线 启动下一个下载任务 代码块5
  121. : lab111111
  122. :: 删除testout中零字节ts最好e:\n零字节也删除一下一定要删除零字节因为零字节ts会导致合并视频失败从而导致testtesttest.ts不变大而不断重启下载进程我为这个浪费了好几天才找到原因
  123. :: for /r E:\N\testout %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  124. call  copy  E:\testout\00006.ts E:\testout\test /y
  125. fciv.exa  E:\testout\00006.ts -md5>11.txt
  126. timeout /nobreak /t 120
  127. :: 调用hebing.bat合并视频
  128. call "E:\testout\test\hebing.bat"
  129. call  copy  E:\testout\00006.ts E:\testout\test /y
  130. fciv.exa  E:\testout\00006.ts -md5>22.txt
  131. fc.exa /b 11.txt 22.txt > nul
  132. if errorlevel 1 (
  133.     :: 视频变大则跳转至此代码块开头隔120秒再监视是否变大
  134.     goto lab111111
  135. ) else (
  136.     :: 视频不变大则启动新下载任务
  137.     taskkill /f /im 1.exe
  138.     taskkill /f /im cmd.exe
  139.     for /r E:\testout\test %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  140.     start cmd /k "1.exe -y -i  [url]http://64.1643.17.9:389/.m3u8[/url] 00007.ts"
  141.     goto lab1111111
  142. )
  143. :: 我是代码分割线 启动下一个下载任务 代码块6
  144. : lab1111111
  145. :: 删除testout中零字节ts最好e:\n零字节也删除一下一定要删除零字节因为零字节ts会导致合并视频失败从而导致testtesttest.ts不变大而不断重启下载进程我为这个浪费了好几天才找到原因
  146. :: for /r E:\N\testout %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  147. call  copy  E:\testout\00007.ts E:\testout\test /y
  148. fciv.exa  E:\testout\00007.ts -md5>11.txt
  149. timeout /nobreak /t 120
  150. :: 调用hebing.bat合并视频
  151. call "E:\testout\test\hebing.bat"
  152. call  copy  E:\testout\00007.ts E:\testout\test /y
  153. fciv.exa  E:\testout\00007.ts -md5>22.txt
  154. fc.exa /b 11.txt 22.txt > nul
  155. if errorlevel 1 (
  156.     :: 视频变大则跳转至此代码块开头隔120秒再监视是否变大
  157.     goto lab1111111
  158. ) else (
  159.     :: 视频不变大则启动新下载任务
  160.     taskkill /f /im 1.exe
  161.     taskkill /f /im cmd.exe
  162.     for /r E:\testout\test %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  163.     start cmd /k "1.exe -y -i  [url]http://64.1643.17.9:389/.m3u8[/url] 00008.ts"
  164.     goto lab11111111
  165. )
  166. :: 我是代码分割线 启动下一个下载任务 代码块7
  167. : lab11111111
  168. :: 删除testout中零字节ts最好e:\n零字节也删除一下一定要删除零字节因为零字节ts会导致合并视频失败从而导致testtesttest.ts不变大而不断重启下载进程我为这个浪费了好几天才找到原因
  169. :: for /r E:\N\testout %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  170. call  copy  E:\testout\00008.ts E:\testout\test /y
  171. fciv.exa  E:\testout\00008.ts -md5>11.txt
  172. timeout /nobreak /t 120
  173. :: 调用hebing.bat合并视频
  174. call "E:\testout\test\hebing.bat"
  175. call  copy  E:\testout\00008.ts E:\testout\test /y
  176. fciv.exa  E:\testout\00008.ts -md5>22.txt
  177. fc.exa /b 11.txt 22.txt > nul
  178. if errorlevel 1 (
  179.     :: 视频变大则跳转至此代码块开头隔120秒再监视是否变大
  180.     goto lab1111111
  181. ) else (
  182.     :: 视频不变大则启动新下载任务
  183.     taskkill /f /im 1.exe
  184.     taskkill /f /im cmd.exe
  185.     for /r E:\testout\test %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  186.     start cmd /k "1.exe -y -i  [url]http://64.1643.17.9:389/.m3u8[/url] 00009.ts"
  187.     goto lab111111111
  188. )
  189. :: 我是代码分割线 启动下一个下载任务 代码块8
  190. : lab111111111
  191. pause
复制代码

  1. if not  "%~1"=="p" start /min zmd.exe /c %0 p&exit
  2. @echo off
  3. for /l %%A in (100001,1,102000) do (
  4.   call :foo1 %%A
  5. )
  6. exit /b
  7. :foo1
  8. :: 删除testout中零字节ts最好e:\n零字节也删除一下一定要删除零字节因为零字节ts会导致合并视频失败从而导致testtesttest.ts不变大而不断重启下载进程我为这个浪费了好几天才找到原因
  9. :: for /r E:\N\testout %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  10. set basename=%1
  11. set /a basename2=%1+1
  12. set basename=%basename:~1%
  13. set basename2=%basename2:~1%
  14. :loop
  15. call  copy  E:\testout\%basename%.ts E:\testout\test /y
  16. fciv.exa  E:\testout\test\%basename%.ts -md5>11.txt
  17. :: 等待120秒的原因是如果文件变大则再复制00001.ts其22txt的md5是不一样的fciv不能访问被1exe下载的文件所以要复制
  18. timeout /nobreak /t 120
  19. :: 调用hebing.bat合并视频
  20. call "E:\testout\test\hebing.bat"
  21. call  copy  E:\testout\%basename%.ts E:\testout\test /y
  22. fciv.exa  E:\testout\test\%basename%.ts -md5>22.txt
  23. fc.exa /b 11.txt 22.txt > nul
  24. if errorlevel 1 (
  25.     :: 视频变大则跳转至此代码块开头隔120秒再监视是否变大
  26.     goto loop
  27. ) else (
  28.     :: 视频不变大则启动新下载任务
  29.     taskkill /f /im 1.exe
  30.     taskkill /f /im cmd.exe
  31.     for /r E:\testout\test %%i in (*.ts) do @(if %%~zi EQU 0 del "%%i" /f)
  32.     start cmd /k "1.exe -y -i  http://64.1643.17.9:389/.m3u8 %basename2%.ts"
  33.    :: 跳转至代码块2 1+1等于2 所以goto 11
  34.    
  35. )
  36. exit /b
复制代码
微信:flashercs
QQ:49908356

TOP

返回列表