Skip to content

Archiving and compression of files in Windows before extracting #

Powershell #

1
2
Compress-Archive -LiteralPath C:\Windows\temp\lsass.dmp -DestinationPath C:\Windows\temp\lsass.zip
ls C:\Windows\temp\lsass.zip
* Unzipping in Linux with unzip lsass.zip does not always work, try 7z x lsass.zip


7zip #

Instructions #

  1. Download 7za.exe from 7zip
    • Download the standable version. Usually contains the description: "7-Zip Extra: standalone console version, 7z DLL, Plugin for Far Manager"
  2. Run on target machine (Windows)
    1
    echo PASSWORD_FOR_ZIP_FILE| 7za.exe a -mhe -p zip_file_name C:\target\folder\*
    
    • Note: Make sure PASSWORD_FOR_ZIP_FILE is next to the “|” pipe symbol, no space in between. If it has space in between, you have to include the space in the password

Tips #

  • Check disk space/partition before archiving a large file or folder
    1
    echo list volume|diskpart
    
  • In case of timeouts given the limited shell when archiving large files

    • Create a batch file:

      1
      2
      archive.bat
      echo PASSWORD_FOR_ZIP_FILE| 7za.exe a -mhe -p zip_file_name C:\target\folder\*
      
    • Run the batch file with start /b archive.bat


Last update: April 16, 2022