本帖最后由 newswan 于 2024-6-9 13:33 编辑
powershell 简单些
for 语法 头疼了- $folder = "D:\xyz\"
-
- Push-Location -Path $folder
-
- Get-ChildItem -Path "*.rar","*.zip" -Recurse | ForEach-Object {
- Write-Host "--$_.FullName--"
- Push-Location -Path $_.DirectoryName
- Start-Process -Wait -FilePath "C:\Program Files\WinRAR\Rar.exe" -ArgumentList " x `"$($_.FullName)`" `"$($_.BaseName)\`""
- Remove-Item -Path $_.FullName
- $ff = $_.BaseName
- Get-ChildItem -Path $ff | ForEach-Object {
- Rename-Item -Path $_.Fullname -NewName ( $ff + "@" + $_.BaseName + $_.Extension )
- }
- Pop-Location
- }
复制代码
|