本次分享的批量解压脚本,统一采用 Bandizip 命令行模式解压,无需手动干预,解放双手。
一、支持的解压流程
脚本自动识别压缩包结构,无需手动切换,两种流程均能自动完成:
-
原版流程:分卷 RAR → JPG 改 RAR → 带密码解压 → 删除汉字 → 最终解压
-
LXNDG 版流程(分享之魔女贝伦卡斯泰露 大佬发布版本):7z.001 → mp4 改 zip → 删除汉字 → 最终解压(现在 LXNDG-xxx 、 LXNDD-xxx 都能直接识别为新流程,想继续加前缀,只改这一行就行:$NewFlowFolderPrefixes = @(“LXNDG”, “LXNDD”, “新前缀”))
二、使用前准备
请务必完成以下准备,避免脚本运行报错:
-
安装 Bandizip 压缩软件(免费,https://www.bandisoft.com/bandizip/);
-
确认电脑中存在以下两个文件(默认安装路径,若修改过安装路径,需同步编辑脚本内对应路径):
-
C:\Program Files\Bandizip\Bandizip.exe
-
C:\Program Files\Bandizip\bz.exe
-
-
脚本保存时,编码选择 UTF-8 with BOM(关键步骤!避免中文密码、文件名乱码)。
$BandizipPath = "C:\Program Files\Bandizip\Bandizip.exe" $BandizipCliPath = Join-Path (Split-Path $BandizipPath -Parent) "bz.exe" $ParentFolder = $PSScriptRoot $Passwords = @("猫里奥小新", "小猫喝奶啤") $LXNDPassword = "LXNDLXND" $NewFlowFolderPrefixes = @("LXNDG", "LXNDD") function Invoke-BandizipExtract { param( [string]$ArchivePath, [string]$OutputDir, [string]$Password = "" ) $Args = @("x", "-o:$OutputDir", "-y") if ($Password) { $Args += "-p:$Password" } $Args += $ArchivePath & $BandizipCliPath @Args | Out-Null } function Remove-MatchingFiles { param( [string]$TargetDir, [string[]]$Patterns ) foreach ($Pattern in $Patterns) { Get-ChildItem -Path $TargetDir -Filter $Pattern -File -ErrorAction SilentlyContinue | Remove-Item -Force -ErrorAction SilentlyContinue } } function Get-FirstMatchingFile { param([string]$TargetDir, [string[]]$Filters) foreach ($Filter in $Filters) { $File = Get-ChildItem -Path $TargetDir -Filter $Filter -File -ErrorAction SilentlyContinue | Select-Object -First 1 if ($File) { return $File } } } function Rename-FileSafely { param([string]$FilePath, [string]$NewName) $NewPath = Join-Path (Split-Path $FilePath -Parent) $NewName if (Test-Path $NewPath) { Remove-Item $NewPath -Force } Rename-Item -Path $FilePath -NewName $NewName -Force return $NewPath } function Test-NewFlowFolder { param([string]$FolderName, [string[]]$TargetDirs) foreach ($Prefix in $NewFlowFolderPrefixes) { if ($FolderName -like "$Prefix*") { return $true } } foreach ($TargetDir in $TargetDirs) { if (Get-ChildItem -Path $TargetDir -Filter "*.7z.001" -File -ErrorAction SilentlyContinue | Select-Object -First 1) { return $true } } return $false } function Expand-LXNDGPackage { param([string]$TargetDir) Write-Host " [LXNDG] 处理目录: $(Split-Path $TargetDir -Leaf)" -ForegroundColor White $VolumeFile = Get-FirstMatchingFile -TargetDir $TargetDir -Filters @("*.7z.001") if (-not $VolumeFile) { Write-Host " -> 未找到分卷压缩包" -ForegroundColor Yellow return } Write-Host " [1/4] 正在解压分卷..." -ForegroundColor Gray Invoke-BandizipExtract -ArchivePath $VolumeFile.FullName -OutputDir $TargetDir -Password $LXNDPassword $Mp4File = Get-FirstMatchingFile -TargetDir $TargetDir -Filters @("*.mp4") if (-not $Mp4File) { Write-Host " -> 未找到 MP4 文件" -ForegroundColor Yellow return } $ZipName = $Mp4File.BaseName + ".zip" $ZipPath = Rename-FileSafely -FilePath $Mp4File.FullName -NewName $ZipName Write-Host " [2/4] MP4 -> ZIP 后继续解压..." -ForegroundColor Gray Invoke-BandizipExtract -ArchivePath $ZipPath -OutputDir $TargetDir -Password $LXNDPassword $DirtyFile = Get-ChildItem -Path $TargetDir -File | Where-Object { $_.Name -like "*删除汉字*" } | Select-Object -First 1 if (-not $DirtyFile) { Write-Host " -> 未找到最终压缩包" -ForegroundColor Yellow return } $CleanName = $DirtyFile.Name -replace "删除汉字", "" $CleanPath = Rename-FileSafely -FilePath $DirtyFile.FullName -NewName $CleanName Write-Host " [3/4] 最终压缩包改名并解压..." -ForegroundColor Gray Invoke-BandizipExtract -ArchivePath $CleanPath -OutputDir $TargetDir -Password $LXNDPassword Write-Host " [4/4] 清理压缩包..." -ForegroundColor Gray Remove-MatchingFiles -TargetDir $TargetDir -Patterns @("*.7z", "*.7z.00*", "*.zip", "*.rar", "*删除汉字*") Write-Host " -> LXNDG 流程完成" -ForegroundColor Green } Write-Host "========================================" -ForegroundColor Cyan Write-Host " 先解压,后删除 (最稳妥)" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan if (-not (Test-Path $BandizipCliPath)) { Write-Host "[错误] 找不到 Bandizip 控制台程序: $BandizipCliPath" -ForegroundColor Red pause exit } $SubFolders = Get-ChildItem -Path $ParentFolder -Directory foreach ($Folder in $SubFolders) { Write-Host "`n[文件夹] $($Folder.Name)" -ForegroundColor White $VariantFolders = Get-ChildItem -Path $Folder.FullName -Directory | Where-Object { $_.Name -in @("A", "P") } $Targets = if ($VariantFolders) { $VariantFolders.FullName } else { @($Folder.FullName) } if (Test-NewFlowFolder -FolderName $Folder.Name -TargetDirs $Targets) { foreach ($TargetDir in $Targets) { if (Get-FirstMatchingFile -TargetDir $TargetDir -Filters @("*.7z.001")) { Expand-LXNDGPackage -TargetDir $TargetDir } } continue } Set-Location $Folder.FullName $CurrentDir = $Folder.FullName $AllDone = $false # 标记是否全部完成 # ========================================================= # 第一步:解压初始分卷 # ========================================================= $PartFile = Get-FirstMatchingFile -TargetDir $CurrentDir -Filters @("*.part1.rar", "*.rar") if ($PartFile) { Write-Host " [1/5] 正在解压分卷..." -ForegroundColor Gray Invoke-BandizipExtract -ArchivePath $PartFile.FullName -OutputDir $CurrentDir $JpgFile = Get-FirstMatchingFile -TargetDir $CurrentDir -Filters @("*.JPG") if ($JpgFile) { $NewName = $JpgFile.BaseName + ".rar" Rename-FileSafely -FilePath $JpgFile.FullName -NewName $NewName | Out-Null Write-Host " [2/5] JPG -> RAR 重命名成功" -ForegroundColor Green } else { Set-Location $ParentFolder; continue } } else { Set-Location $ParentFolder; continue } # ========================================================= # 第二步:第一次带密码解压 # ========================================================= $RarStage1 = Get-ChildItem -Filter "*.rar" | Where-Object { $_.Name -notlike "*.part*" } | Select-Object -First 1 if ($RarStage1) { $Success = $false Write-Host " [3/5] 正在尝试第一次密码解压..." -ForegroundColor Gray foreach ($Pwd in $Passwords) { Invoke-BandizipExtract -ArchivePath $RarStage1.FullName -OutputDir $CurrentDir -Password $Pwd $DirtyFile = Get-ChildItem | Where-Object { $_.Name -like "*删除汉字*" } | Select-Object -First 1 if ($DirtyFile) { $Success = $true Write-Host " -> 密码正确 ($Pwd)" -ForegroundColor Green $CleanName = $DirtyFile.Name -replace "删除汉字", "" Rename-FileSafely -FilePath $DirtyFile.FullName -NewName $CleanName | Out-Null break } } if (-not $Success) { Set-Location $ParentFolder; continue } } # ========================================================= # 第三步:最后一次解压 # ========================================================= $RarStage2 = Get-ChildItem -Filter "*.rar" | Where-Object { $_.Name -notlike "*.part*" } | Select-Object -First 1 if ($RarStage2) { $Success = $false Write-Host " [4/5] 正在尝试最终解压..." -ForegroundColor Gray foreach ($Pwd in $Passwords) { Invoke-BandizipExtract -ArchivePath $RarStage2.FullName -OutputDir $CurrentDir -Password $Pwd # 检查是否成功(只要文件夹里除了这个rar还有别的东西,或者rar消失了) $CheckFile = Get-ChildItem | Where-Object { $_.Name -ne $RarStage2.Name -and $_.Name -notlike "*.part*" } if ($CheckFile) { $Success = $true $AllDone = $true Write-Host " -> 密码正确 ($Pwd)" -ForegroundColor Green break } } if ($Success) { Write-Host " [5/5] 全部解压成功!" -ForegroundColor Green } } # ========================================================= # 【新增】最后一步:统一删除所有压缩包 # ========================================================= if ($AllDone) { Write-Host " [清理] 正在删除所有压缩包文件..." -ForegroundColor Gray Remove-MatchingFiles -TargetDir $CurrentDir -Patterns @("*.part*.rar", "*.rar") Write-Host " [完成] 清理完毕!" -ForegroundColor Green } Set-Location $ParentFolder } Write-Host "`n脚本执行完毕。" -ForegroundColor Cyan pause
三、使用方法
-
放置脚本:将脚本文件(命名为 batch_decompress.ps1),放在需要批量处理的 父目录 中,目录结构示例如下:
├─ 下载游戏的文件夹
├─ batch_decompress.ps1(脚本文件)
├─ R-xxx(游戏,待处理)
├─ LXNDG-xxx(游戏,待处理) -
自动识别:脚本运行后,会自动遍历父目录下的所有子文件夹,无需手动选择;
-
执行脚本:
-
在父目录空白处,按住 Shift 键 + 鼠标右键;
-
选择「在此处打开 PowerShell 窗口」或「在终端中打开」;
-
输入命令并回车:
.\batch_decompress.ps1; -
等待完成:脚本会自动执行所有解压步骤,全程无需手动操作。
-
四、注意事项(必看)
-
测试建议:第一次使用时,建议先选取 1-2 个少量文件夹测试,确认流程无误后再批量处理;
-
禁止操作:解压过程中,请勿手动修改任何文件的名称、后缀,避免脚本识别失败;
-
自动清理:脚本默认在 所有解压步骤完成且确认成功后,自动清理所有压缩包(分卷、中间包等),只保留最终解压文件;
-
密码修改:若压缩包密码与默认不同,可直接编辑脚本:
-
旧版流程密码:修改脚本内
$Passwords变量; -
新版流程密码:修改脚本内
$LXNDPassword变量。
-
脚本已优化稳定性,适配大部分场景,如有运行报错或适配问题,欢迎留言交流~
© 版权声明
本站资源均为免费下载,文章版权归作者所有,未经允许请勿转载。如果文章内容侵犯了您的权益,请联系eohut666#gmail.com删除。
THE END


![母娘调教[SLG/PC/步兵/SecretGarden]-EoHut 电光小屋](https://img.eohut.com/upldata/2026/06/21/6a378d4bbbf9d.jpg)




![【SLG/官中/3D】AV导演生活[Ver1.016+步兵补丁+存档+能量不减CT]【PC/3.60G】-EoHut 电光小屋](https://image.acg.lol/file/2025/01/17/ss_fbc3f92d67ff77505b9b80db2d2aeef9bb0df28b.1920x1080.jpg)

- 最新
- 最热
只看作者