找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 23123|回复: 2

[文本处理] [已解决]批量获取以序号命名的html,并以html文本里的标题重命名网页

[复制链接]
发表于 2019-11-18 16:31:35 | 显示全部楼层 |阅读模式
批量获取以序号命名的html,并以html文本里的标题重命名网页

下面是自己写的代码,速度较慢,怎么写快些呢?
—————————————————————

  1. @echo off
  2. chcp 65001
  3. for /f "delims=" %%i in ('dir /a-d /b *.html') do (
  4.         for /f "delims=" %%j in ('type %%i^|findstr /rc:"<title>"') do (
  5.                 for /f "tokens=2,3* delims=>_" %%a in ("%%j") do (
  6.                 ren "%%~nxi" "%%a%%~xi"
  7.                 )
  8.         )
  9. )
  10. pause>nul
复制代码
 楼主| 发表于 2019-11-18 20:07:28 | 显示全部楼层
简化了一下,但是速度没有明显的变化
_______________________________

  1. @echo off
  2. chcp 65001
  3. for /f "delims=" %%i in ('dir /a-d /b *.html') do (
  4.         for /f "tokens=2,3* delims=>_" %%j in ('type %%i^|findstr /irc:"<title>"') do (
  5.                 ren "%%~nxi" "%%j%%~xi"
  6.         )
  7. )
  8. pause>nul
复制代码
发表于 2019-11-18 20:08:52 | 显示全部楼层
  1. @echo off
  2. cd /d "%~dp0"
  3. chcp 65001
  4. for /f "tokens=1* delims=:" %%A in ('findstr /ilc:"<title>" *.html') do (
  5.   for /f "tokens=2 delims=>_" %%a in ("%%B") do (
  6.     ren "%%A" "%%a.*"
  7.   )
  8. )
  9. pause
  10. chcp 936
  11. exit /b
复制代码

评分

参与人数 1技术 +1 收起 理由
wxyz0001 + 1 乐于助人

查看全部评分

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-17 06:30 , Processed in 0.018284 second(s), 9 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表