# --- Paths --- $mainZip = "C:\Users\PC\Downloads\Compressed\cars.zip" $tempDir = "$env:TEMP\cars_temp" $targetDir = "D:\SteamLibrary\steamapps\common\assettocorsa" # --- 1. Clean and create temp folder --- if (Test-Path $tempDir) { Remove-Item $tempDir -Recurse -Force } New-Item -ItemType Directory -Path $tempDir | Out-Null # --- 2. Extract the main ZIP into temp folder --- Expand-Archive -Path $mainZip -DestinationPath $tempDir -Force # --- 3. Find all ZIPs inside and extract them directly into target --- Get-ChildItem -Path $tempDir -Recurse -Filter *.zip | ForEach-Object { Write-Host "Extracting $($_.FullName) → $targetDir" Expand-Archive -Path $_.FullName -DestinationPath $targetDir -Force } # --- 4. Cleanup temp folder --- Remove-Item $tempDir -Recurse -Force Write-Host "✅ All inner ZIP files extracted successfully!"