[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
powershell
  1. <# :
  2. @echo off
  3. powershell -noprofile -NoLogo "iex (${%~f0} | out-string)"
  4. pause
  5. exit
  6. #>
  7. $regex = '<title>Index\s*of\s*/([^<]+)'
  8. $pan = 'alt=\"\[\s*\]\">\s*<a href=\"'
  9. $content = [IO.File]::ReadAllText('index.txt ')
  10. $title = [regex]::matches($content, $regex).Groups[1].Value + '\'
  11. [regex]::Replace($content,$pan, $title)|Out-File $('new_'+'index.txt ')
复制代码

TOP

回复 3# a574045075
区分一下大小写
  1. <# :
  2. @echo off
  3. powershell -noprofile -NoLogo "iex (${%~f0} | out-string)"
  4. pause
  5. exit
  6. #>
  7. $regex = '(?i)<(title)>index\s*of\s*/([^<]+)</\1>'
  8. $pan = '(?i)alt=\"\[\s*\]\">\s*<a href=\"'
  9. $content = [IO.File]::ReadAllText('index.txt ')
  10. $title = [regex]::matches($content, $regex).Groups[2].Value + '\'
  11. [IO.File]::WriteAllText('new_index.txt', [regex]::Replace($content,$pan, $title))
复制代码
1

评分人数

TOP

返回列表