Board logo

标题: [文本处理] [已解决]求一个生成这种文本文件的批处理。 [打印本页]

作者: xbee    时间: 2014-8-24 22:49     标题: [已解决]求一个生成这种文本文件的批处理。

本帖最后由 xbee 于 2014-8-25 10:48 编辑

生成这种txt文件,内容规律如下(原内容不方便贴出来),能不能给个通用一点的批处理我自己改一改?
http://www.bathome.net/forum-5-1.html
http://www.bathome.net/forum-5-2.html
http://www.bathome.net/forum-5-3.html
。。。。。。
http://www.bathome.net/forum-5-n.html
n等于几百到几千
作者: CrLf    时间: 2014-8-24 22:58

本帖最后由 CrLf 于 2014-8-24 23:00 编辑

纯批
  1. set /a n=1000
  2. (for /l %%a in (1 1 %n%) do http://www.bathome.net/forum-5-1.html)>输出.txt
复制代码

作者: CrLf    时间: 2014-8-24 23:00

本帖最后由 CrLf 于 2014-8-24 23:02 编辑

powershell
  1. 0..1000 | %{'http://www.bathome.net/forum-5-' + $_ + '.html'} | sc 输出.txt
复制代码

作者: xbee    时间: 2014-8-24 23:11

回复 2# CrLf
不行?怎么回事?
作者: CrLf    时间: 2014-8-24 23:54

回复 4# xbee


    你是用什么浏览器复制的,代码连成一行了
作者: Linuxer    时间: 2014-8-25 09:20

回复 4# xbee
  1. @echo off
  2. set /a n=1000
  3. (for /l %%a in (1 1 %n%) do echo http://www.bathome.net/forum-5-%%a.html)>输出.txt
  4. pause
复制代码
你把crlf大神的代码稍微加工一下就可以了。
作者: Linuxer    时间: 2014-8-25 09:27

回复 2# CrLf


    刚想了下没想出来,o(︶︿︶)o 唉,,原来是这样写的。。我还得多思考啊
好像是漏了echo和%%a
作者: xbee    时间: 2014-8-25 10:41

感谢各位解答,6楼代码可以用!




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