Software-OK
≡... News | ... Home | ... FAQ | Impressum | Contact | Listed at | Thank you |

  
HOME ► Faq ► FAQ - PowerShell ► ««« »»»

Can I create and unpack ZIP folders with PowerShell?


It's not exactly easy, but you can create ZIP files (folders, archives) and unpack them with PowerShell from version 5.0 on all MS Windows 11, 10, ... and Server OS!



Everyone probably knows how easy it is to  ►► query the ► PowerShell version to check if you can  create and unpack ZIP files with the installed PowerShell version. Here you will learn how easy it is to zip and/or unzip files with PowerShell.

Contents:

1.) ... Create a zip file with PowerShell!
2.) ... Only add certain files to the existing zip archive!
3.) ... Unpack the zip file / archive with PowerShell!
4.) ... Why create and unpack ZIP files with PowerShell? 
5.) ... What should I watch out for with the ZIP files and PowerShell? 




1.) Create a zip file with PowerShell!

Example: A simple compression of a folder with all contents to Das_Archiv.zip 


Compress-Archive -Path C:\Path\Of\Data\* -DestinationPath C:\Path\Of\The_Archive.zip


In this example, the path is specified from a directory containing multiple files and folders without specifying individual files filters. PowerShell compresses everything within the directory, both subfolders and all files.

The target directory (C:\Path\Des\) must exist, otherwise an error message will appear and Das_Archiv.zip cannot be created!

2.) Only add certain files to the existing zip archive!

Example: A simple compression of a folder with all content but with the *.txt filter to add only plain text files  to the existing archive.zip!  



Compress-Archive -Path C:\Path\Of\Data\*.txt -DestinationPath C:\Path\Of\Archives.zip   -Update



Don't forget the -update parameter to overwrite existing data  <<< Important

Even after the archiving is complete, you can update any existing ZIP file with the parameter. You can replace older file versions in the archive with newer ones with the same file name and add new files created in the root directory.

PS: If you want to update all the data in the zip archive, just use "*" like in the first example.

3.) Unpack the zip file / archive with PowerShell!


Almost self-explanatory, all you need to specify is the source ZIP file and a destination path for storing the data, which will then be unzipped there.



Expand-Archive  -Path C:\Path\Of\Archoive.zip -DestinationPath C:\Path\Of\Data  -Force


Parameters:  -Force only use if the data should really all be overwritten ► Expand-Archive also has other parameters



4.) Why create and unpack ZIP files with PowerShell? 

The ZIP file format, or zip folder , reduces the size of files by compressing them into a single file. This process saves disk space, encrypts data, and makes it easy to share files with others. For example to upload to a server or to share with others in the cloud.

As you can see, PowerShell can not only compress files and folders, but also decompress zip archives. The process is easy to both compress and decompress ! 

5.) What should I watch out for with the ZIP files and PowerShell? 

The target folder to which the files should be extracted will be filled with the contents of the archive. If the folder doesn't exist before unzipping, PowerShell creates the folder and saves the contents to it when unzipping.



Tips:

►► Decode, Encode, Decompress, Compress?
►► Compress and unpack the files under Windows 11!
►► Create non-compressible files!
►► Activate drive compression on Windows 10 / 11!
►► Difference between zip folder and folder?
►► Difference 7-Zip and Zip format, archive?







FAQ 15: Updated on: 16 June 2022 12:01 Windows
PowerShell

The help for the modules could not be updated?


If the help for the modules cannot be updated on MS Windows 11, 10, Desktop or other Microsoft Server operating systems, the solution PowerShell help guides
PowerShell

Easily download files with PowerShell?


Sometimes you just want to download files with PowerShell under MS Windows 11, 10, or Microsoft Server For example, to download a file from an Internet
PowerShell

Quickly change the Windows 11, 10, ... language with PowerShell!


The display language in Windows 11, 10, is the display language you have selected, the default language is used by all Windows settings, file explorer,
PowerShell

How can I use the command history in Windows PowerShell?


The command history in PowerShell should be used because it is practical, the integrated command history function is very popular under Windows 11, 10,
PowerShell

Customize the font in PowerShell and add more fonts, but how?


In Powershell you can also change and adapt the font and add more, under Windows 11, 10, and MS Server OS, how is no longer a question 1. Use a
PowerShell

Can I list user accounts through PowerShell?


It is quite easy to list user accounts via PowerShell with a small command that works under Windows 11, 10, and MS Server operating systems If you run

»»

  My question is not there in the FAQ
Asked questions on this answer:
Keywords: powershell, create, unpack, folders, with, exactly, easy, files, archives, them, from, version, windows, Questions, Answers, Software




    

  + Freeware
  + Order on the PC
  + File management
  + Automation
  + Office Tools
  + PC testing tools
  + Decoration and fun
  + Desktop-Clocks

  + SoftwareOK Pages
  + Micro Staff
  + Freeware-1
  + Freeware-2
  + Freeware-3
  + FAQ
  + Downloads

  + Top
  + Desktop-OK
  + The Quad Explorer
  + Don't Sleep
  + Win-Scan-2-PDF
  + Quick-Text-Past
  + Print Folder Tree
  + Find Same Images
  + Experience-Index-OK
  + Font-View-OK


  + Freeware
  + FontViewOK
  + MeinPlatz
  + DesktopOK
  + ProcessKO
  + WinBin2Iso
  + ThisIsMyFile
  + TheAeroClock
  + CoronaKO
  + MatriX.CoronaKO
  + PAD-s


Home | Thanks | Contact | Link me | FAQ | Windows 2021 | Windows 10 | English-AV | Impressum | Translate | PayPal | PAD-s

 © 2022 by Nenad Hrg softwareok.de • softwareok.com • softwareok.com • softwareok.eu
0.061


► How can I print only the directory tree / folder structure? ◄ ► Disable Bitlocker, Windows-10? ◄ ► Open New Tab Via Drag and Drop in all / from all Explorer Views! ◄ ► What is a pixel? ◄ ► Open recording devices Line-In directly via desktop shortcut! ◄ ► Mouse traces of snow flakes under W10! ◄ ► Can I uninstall Microsoft Edge? ◄ ► Block emails from specific senders in Microsoft Outlook! ◄
This website uses cookies to ensure you get the best experience on our website more Infos & Privacy Policy
....