Board logo

标题: [文本处理] [已解决]请帮忙看看bat脚本批量生成网址哪里错了? [打印本页]

作者: skpkmon    时间: 2022-10-25 14:57     标题: [已解决]请帮忙看看bat脚本批量生成网址哪里错了?

本帖最后由 skpkmon 于 2022-10-25 17:24 编辑
  1. @echo off
  2. Setlocal enabledelayedexpansion
  3. for /l %%a in (0005 1 1000)do (
  4. set /a n+=1
  5. if !n! lss 100 (set n1=0!n!)else set n1=!n!
  6. echo !n1!,http://126.40.191.58:9901/tsfile/live/0005_1.m3u8?blog.ntnas.top>>B.txt)
复制代码
现在执行后结果是这样:
01,http://126.40.191.58:9901/tsfile/live/0005_1.m3u8?blog.ntnas.top
02,http://126.40.191.58:9901/tsfile/live/0005_1.m3u8?blog.ntnas.top
03,http://126.40.191.58:9901/tsfile/live/0005_1.m3u8?blog.ntnas.top
04,http://126.40.191.58:9901/tsfile/live/0005_1.m3u8?blog.ntnas.top
05,http://126.40.191.58:9901/tsfile/live/0005_1.m3u8?blog.ntnas.top
                                              ///
996,http://126.40.191.58:9901/tsfile/live/0005_1.m3u8?blog.ntnas.top

各位大师,请帮帮忙,这是以前的一位师兄给我的,但日子久了忘了怎样改,
执行bat后希望结果应是以下这样:
01,http://126.40.191.58:9901/tsfile/live/0001_1.m3u8?blog.ntnas.top
02,http://126.40.191.58:9901/tsfile/live/0002_1.m3u8?blog.ntnas.top
03,http://126.40.191.58:9901/tsfile/live/0003_1.m3u8?blog.ntnas.top
04,http://126.40.191.58:9901/tsfile/live/0004_1.m3u8?blog.ntnas.top
05,http://126.40.191.58:9901/tsfile/live/0005_1.m3u8?blog.ntnas.top
                                             ///
996,http://126.40.191.58:9901/tsfile/live/0996_1.m3u8?blog.ntnas.top
作者: qixiaobin0715    时间: 2022-10-25 15:17

  1. @echo off
  2. setlocal enabledelayedexpansion
  3. (for /l %%a in (10001,1,10996) do (
  4.     set n2=%%a
  5.     if %%a lss 10100 (set n1=!n2:~-2!) else set n1=!n2:~-3!
  6.     echo,!n1!,http://126.40.191.58:9901/tsfile/live/!n2:~-4!_1.m3u8?blog.ntnas.top
  7. ))>b.txt
复制代码

作者: skpkmon    时间: 2022-10-25 16:06

回复 2# qixiaobin0715

多谢师兄,解决了我的问题

但如果网址是这样呢?
http://126.40.191.58:9901/tsfile/live/123001_1.m3u8?blog.ntnas.top
http://126.40.191.58:9901/tsfile/live/123002_1.m3u8?blog.ntnas.top
                                                 ///
http://126.40.191.58:9901/tsfile/live/123999_1.m3u8?blog.ntnas.top
谢谢你帮忙
作者: qixiaobin0715    时间: 2022-10-25 16:11

  1. @echo off
  2. (for /l %%a in (123001,1,123999) do (
  3.     echo,http://125.40.191.58:9901/tsfile/live/%%a_1.m3u8?blog.ntnas.top
  4. ))>b.txt
复制代码

作者: skpkmon    时间: 2022-10-25 16:48

回复 4# qixiaobin0715


再次多谢帮忙




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2