User Tools

Site Tools


powershell:extraer_zip_en_batch

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
powershell:extraer_zip_en_batch [2026/08/20 13:25] – created adm.wikipowershell:extraer_zip_en_batch [2026/08/26 14:57] (current) – adm.wiki
Line 1: Line 1:
-====== Extraer .zip en Batch ======+====== Extraer .zip en Batch/Serie ====== 
 +**partiendo desde aqui:** 
 +{{.:pasted:20260820-134350.png}}
  
 +**Codigo:**
 +
 +<code powershell zip_extractor.ps1>
 +$files = Get-ChildItem "F:\x360" -Filter "*.7z" -File
 +
 +foreach ($file in $files) {
 +
 +    $destination = Join-Path "G:\x360iso" $file.BaseName
 +
 +    New-Item -ItemType Directory -Path $destination -Force | Out-Null
 +
 +    Write-Host "Extrayendo: $($file.Name)"
 +
 +    & "C:\Program Files\7-Zip\7z.exe" x -y `
 +        $file.FullName `
 +        "-o$destination"
 +
 +    Write-Host "Terminado: $($file.Name)"
 +}
 +</code>
 +**Output**
 +{{.:pasted:20260820-133016.png}}
 +
 +**Explicacion:**
 +  $files = Get-ChildItem "F:\x360" -Filter "*.7z" -File
 + crea la variable $files de tipo array con los nombres de archivo que terminan en .zip
 +  foreach ($file in $files)
 +foreach (bucle), trabaja con $file
 +  $destination = Join-Path "G:\x360iso" $file.BaseName
 +variable, $file.Basename, es igual a ej. "batman arkham city"  
 +  New-Item -ItemType Directory -Path $destination -Force | Out-Null
 +crea el directory "batman arkham city"
 +    Write-Host "Extrayendo: $($file.Name)"
 +Escribe/muestra en la terminal extrayendo "batman arkham city"
 +    & "C:\Program Files\7-Zip\7z.exe" x -y `
 +        $file.FullName `
 +        "-o$destination"
 +Descomprime en su carpeta destino, sin confirmacion, usando 7zip.
 +    Write-Host "Terminado: $($file.Name)"
 +ultimo mensaje en la terminal, y luego viene el siguiente string del array.
  
powershell/extraer_zip_en_batch.1787225145.txt.gz · Last modified: by adm.wiki