96

I am looking to use the command line 7-Zip to unzip a folder.

I have a file, say example.zip and want to unzip the contents of the file into a folder called example.

What are the commands I need to do this?

duhaas
  • 1,083

5 Answers5

125

7z x example.zip -oexample

Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
       [<@listfiles...>]

<Commands>
...
  x: eXtract files with full paths
<Switches>
...
  -o{Directory}: set Output directory

Edit:

7z x *.zip -o*

extracts all *.zip archives to subfolders with names of these archives.

Strangely, I had to go to the full help file to find this example; it isn't shown for 7z /?.

Kenny
  • 148
Anonymous
  • 1,824
20

The syntax would be: 7z x <path to>\duane.zip -oc:\duane

This will extract the content of the archive duane.zip to the folder c:\duane with full paths.

Note: There is NO space between the switch -o and the destination folder. If that folder does not exist, it will be created automatically.

7

For p7zip:

7za e file.7z
3

Recursively extract a single file, or a selective set of files from an archive into the current folder:

7za.exe e art.archive -ir!*Art.jpg
Gareth
  • 19,080
Mitch
  • 31
1

Without 7-zip powershell v3+ can extract a zip file:

Expand-Archive "Source" "Destination"
wasif
  • 9,176