[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. <#*,:&cls
  2. @echo off
  3. pushd "%~dp0"
  4. Powershell -NoProfile -ExecutionPolicy RemoteSigned -Command ". ([ScriptBlock]::Create((Get-Content -LiteralPath \"%~0\" -ReadCount 0 | Out-String ))) "
  5. popd
  6. pause
  7. exit /b
  8. #>
  9. Add-Type -AssemblyName System.IO.Compression.FileSystem
  10. # 目录列表,绝对路径或相对路径
  11. Get-ChildItem -Path *.txt -Recurse | Foreach-Object {
  12.   if (!$_.PSIsContainer) {
  13.     $_.PSChildName
  14.   }
  15. } -OutVariable txtlist | Out-Null
  16. Get-ChildItem -Path *.zip -Recurse | ForEach-Object {
  17.   if (!$_.PSIsContainer) {
  18.     try {
  19.       $archive = [System.IO.Compression.ZipFile]::Open($_.FullName, 'Read')
  20.       $archive.Entries | ForEach-Object {
  21.         if ($_.Name -like '*.txt') {
  22.           $_.Name
  23.         }
  24.       }
  25.     } finally {
  26.       $archive.Dispose()
  27.     }
  28.   }
  29. } -OutVariable +txtlist | Out-Null
  30. $txtlist | Group-Object -OutVariable groupinfos
  31. "`n文本文件数量: " + $groupinfos.Count
复制代码
微信:flashercs
QQ:49908356

TOP

返回列表