Board logo

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

作者: wxyz0001    时间: 2019-11-18 16:31     标题: [已解决]批量获取以序号命名的html,并以html文本里的标题重命名网页

批量获取以序号命名的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
复制代码

作者: wxyz0001    时间: 2019-11-18 20:07

简化了一下,但是速度没有明显的变化
_______________________________
  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
复制代码

作者: flashercs    时间: 2019-11-18 20:08

  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
复制代码





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