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

[文本处理] 批处理提取文本最后一行 做TXT文件名,哪里出错了?

这个代码不能用  请问是哪里出错了
  1. @echo on
  2. setlocal enabledelayedexpansion
  3. for %%a in (*.txt) do set "txt=%%a" & call :aa&&ren "%%~fa" "!b::=!%%~xa"
  4. pause
  5. :aa
  6. for /f "usebackq delims=*" %%b in ("!txt!") do (
  7.     set "a=%%a" & set "b=%%b"
  8. )
  9. echo +++ "!a!" "!b!.txt"
  10. if exist "!b!.txt" (
  11.     echo --- 重复
  12. ) else (
  13. )
  14. goto :eof
复制代码
PS  如果我想提取特定字符后面的几位文字 给TXT重命名?
比如:

比如  TXT中的内容是这样的

https://home.net/w9ql8n4z2gky/_Spencer_Laval_and_Justin_Matthews__720p
wist.com/th/25572/5ov2u3cdm454
FSAKDFSA点击下载-- i love:/\/  you  *?so :/\/:*?“<>|  much  

然后我要提取   点击下载--后面的   i  love  you  so   much 做为文件名    因为:/ 是特殊字符 所以遇到有特殊字符要删除


最终得到的TXT名是这样的    i  love  you  so   much.txt
请问批处理要怎么写  谢谢了!

回复 2# Batcher


  谢谢大大 但是这个只能 处理一个文件名为1.txt的文件 ,我想处理文件夹里所有TXT的文件,并且大大这个命令也会提取指定关健字之前的文字  麻烦改一下 谢谢了

TOP

回复 2# Batcher


谢谢大大 ,但是大大这只能处理一个,并且大大这个会把有些文件里的关健词之前的字也提取了 请问怎么改可以批处理文件夹内的所有TXT文件并且只提取关健词之后的字,谢谢了

TOP

回复 5# GEVENS


   



1. 点击“普通下载FDGSDGGDFSGSD
JLDKSFAJLFSALDJJJFJALSD载
下载地址:[url=http://qwefassfa.net/fs/6JNcEEdR0992968997/]点击下载-- Arthur & Lucas25523423.mp4



比如这个文本

TOP

回复 7# Batcher


    (点击下载--)括号里面 是关键字  测试的结果是文件名变成这样了urlhttpqwefassfanetfsJNcEEdR Arthur  Lucasmp  如果按要求应该是这样  Arthur & Lucas25523423mp

TOP

win8的操作系统  ,大大的这个只能处理一个 同名文件吗 ?我想批处理文件

TOP

回复 11# Batcher


    我已经上传 了大大

TOP

本帖最后由 GEVENS 于 2018-10-14 00:50 编辑

非常感谢你 我的大大 。能否使输出的文件按分类好的文本自动以匹配好的名字输出并以匹配的字符做为文件名

因为按您的命令分类好是这样:
[U,RL=https://bathome.net/w9ql8n4z2gky/_HOTand_Justin_Matthews__720p_.mp4.torrentc__1_.jpg][IM。G]https://img200.bathome.net/th/25578/w9ql8n4z2gky.jpg[IM。G][U,RL
[U,RL=https://bathome.net/8tf7sjuofmcw/_HOTand_Justin_Matthews__720p_.mp4.torrentc__2_.jpg][IM。G]https://img200.bathome.net/th/25578/8tf7sjuofmcw.jpg[IM。G][U,RL
[U,RL=https://bathome.net/sribjmyi3qgt/_HOTand_Justin_Matthews__720p_.mp4.torrentc__3_.jpg][IM。G]https://img200.bathome.net/th/25578/sribjmyi3qgt.jpg[IM。G][U,RL
[U,RL=https://bathome.net/1i8vykf5bv3x/_HOTand_Justin_Matthews__720p_.mp4.torrentc__4_.jpg][IM。G]https://img200.bathome.net/th/25578/1i8vykf5bv3x.jpg[IM。G][U,RL
[U,RL=https://bathome.net/2o05tdhpzxow/_HOTand_Justin_Matthews__720p_.mp4.torrentc__5_.jpg][IM。G]https://img200.bathome.net/th/25578/2o05tdhpzxow.jpg[IM。G][U,RL
[ur.l=http://bathome.ne/fs/1J1NbE1E9R40b9c266/]点击进入下载- HOTand Justin Matthews (720p).mp4.torrentc (1).torrent[U,RL



[U,RL=https://bathome.net/onp7trgng826/Jesse__1_.JPG][IM。G]https://img200.bathome.net/th/25578/onp7trgng826.jpg[IM。G][U,RL
[U,RL=https://bathome.net/eqxpxelckmnp/Jesse__2_.jpg][IM。G]https://img200.bathome.net/th/25578/eqxpxelckmnp.jpg[IM。G][U,RL
[U,RL=https://bathome.net/0twpresz23co/Jesse__3_.JPG][IM。G]https://img200.bathome.net/th/25578/0twpresz23co.jpg[IM。G][U,RL
[U,RL=https://bathome.net/pwvgi2ctip3g/Jesse__4_.jpg][IM。G]https://img200.bathome.net/th/25578/pwvgi2ctip3g.jpg[IM。G][U,RL
[ur.l=http://bathome.ne/fs/fJNeEE2R09926614c4/]点击进入下载-Jesse (1).torrent[ur.l]



[U,RL=https://bathome.net/amdhxf484ogx/Jones_47__1_.jpg][IM。G]https://img200.bathome.net/th/25578/amdhxf484ogx.jpg[IM。G][U,RL
[U,RL=https://bathome.net/bqdeph1ow9yu/Jones_47__2_.jpg][IM。G]https://img200.bathome.net/th/25578/bqdeph1ow9yu.jpg[IM。G][U,RL
[U,RL=https://bathome.net/mgkp502pf28s/Jones_47__3_.jpg][IM。G]https://img200.bathome.net/th/25578/mgkp502pf28s.jpg[IM。G][U,RL
[U,RL=https://bathome.net/libk0gwwg3r6/Jones_47__4_.jpg][IM。G]https://img200.bathome.net/th/25578/libk0gwwg3r6.jpg[IM。G][U,RL
[ur.l=http://bathome.ne/fs/9JeN8EeE8R80b93269/]点击进入下载-Jones 47 (1).torrent[ur.l]

[U,RL=https://bathome.net/a62yt1ji91ry/Todd__1_.jpg][IM。G]https://img200.bathome.net/th/25578/a62yt1ji91ry.jpg[IM。G][U,RL
[U,RL=https://bathome.net/lgjgv11ua0wo/Todd__2_.jpg][IM。G]https://img200.bathome.net/th/25578/lgjgv11ua0wo.jpg[IM。G][U,RL
[U,RL=https://bathome.net/1b6f44su29yg/Todd__3_.jpg][IM。G]https://img200.bathome.net/th/25578/1b6f44su29yg.jpg[IM。G][U,RL
[U,RL=https://bathome.net/zicq6sqhza23/Todd__4_.jpg][IM。G]https://img200.bathome.net/th/25578/zicq6sqhza23.jpg[IM。G][U,RL
[ur.l=http://bathome.ne/fs/9J4N9E4EbR70090263/]点击进入下载-Todd (1).torrent[ur.l]  

但是我最后想达到这样的效果,就是使分类好的文件分割成同等的单独的份数并以匹配的字符命名文件。

按照样本输出最终是:      HOTand Justin Matthews (720p).mp4.torrentc.txt          Jesse (1).txt       Jones 47 (1).txt       Todd (1).txt      


谢谢大大了

TOP

返回列表