Unpack zip in windows

Unpack zip in windows

a command line
multi function tool.

free external tools,
zero install effort,
usb stick compliant:

How to get zip and unzip on the windows command line for quick creation and extraction of zip compressed files.

Download the free Windows executables: (for Linux, see below)

    to extract zip files on the command line, download unzip.exe here.

this file is a copy of the original Info-ZIP unzip.exe version 5.52, provided for free under the Info-ZIP license. Alternatively, you may download it via the original Info-ZIP website.

How to use unzip? Read the examples below.

to create zip files on the command line, download zip.exe here.

this file is a copy of the original Info-ZIP zip.exe version 2.32, provided for free under the Info-ZIP license. Alternatively, you may download it via the original Info-ZIP website.

How to use zip? Read the examples below.

  • to create or extract zip files more flexible, like
    • include or exclude sub folders or filenames
    • zip only files changed today, or in the last 3 days
    • with full UTF-8 unicode filename support

    download Swiss File Knife here. Then type sfk zip or sfk unzip and read the examples.

    this tool is created and maintained only by this website, www.stahlworks.com, and not associated with Info-ZIP. Swiss File Knife Base is Free Open Source, BSD licensed. (more)

    to extract .tar.gz and .tar.bz2 files under windows, download:

    gzip.exe 1.3.12 a copy from http://gnuwin32.sourceforge.net/
    bzip2.exe 1.0.5 a copy from http://www.bzip.org/
    tar.exe a copy from http://sourceforge.net/projects/unxutils/

    All binaries can be used instantly, requiring no further DLL’s.
    Some command examples:

    gzip -d foo.tar.gz uncompresses foo.tar.gz, replacing it by foo.tar
    bzip2 -d foo.tar.bz2 uncompresses foo.tar.bz2, replacing it by foo.tar
    tar tvf foo.tar lists the contents of foo.tar
    tar xvf foo.tar extracts the contents of foo.tar
    • Zip and Unzip for newer (lib6 based) distributions: unzip 5.51, zip 2.3
    • Zip and Unzip for older (lib5 based) distributions: unzip 5.50, zip 2.3

    These files are copies from the Info-Zip download locations listed above,
    provided under the Info-ZIP license.

  • The gzip, bzip2 and tar commands should be available on your linux already.
  • zzfind and sfk for newer (lib6 based) distributions: zzfind, sfk
  • zzfind and sfk for newer (lib5 based) distributions: zzfind, sfk

    These files are provided for free under the BSD license.

    Further zip tools of possible interest:

    Although not discussed here, it should be mentioned that the original Info-ZIP homepage provides further tools, e.g. for the creation of self-extracting zips, gzip and zipsplit, and of course zip/unzip binaries for many other operating systems.

    Example for searching through zip file contents:

    searches all .java files within eclipse.zip for lines with the words «public» AND «class».
    Note that zzfind can also search files in a zip within a zip (nested zips).

    How to list nested zip file contents (zips or jars within zips):

    For example, if you download the Eclipse SDK and type you get a listing of less than 2000 files, listing also .jar file names. But how can you also list what is inside the .jar files, without the need to extract everything first?

    Download Swiss File Knife Base, then type: This will produce a listing of all files, no matter how deeply nested — in total nearly 70000 lines that can be very long, for example:

    eclipse-SDK-3.3.2-win32.zip\\eclipse\plugins
    \org.eclipse.ant.core_3.1.200.v20070522.jar\\lib
    \antsupportlib.jar\\org\eclipse\ant
    \internal\core\ant\EclipseAntMain.class

    The above is the text of a single line (filename), split into 4 lines here for better reading.

    As you can see, there is a .class file in a .jar within another .jar within the .zip.

    Limitations: SFK may not be able to process very large zip files, zip files with an unusual compression method, or 64 bit zip files. Type sfk help xe to list all limitations.

    How to list the contents of all .zip files in all subdirectories:

    In the example above, we listed the content of a single zip file. But sfk can also list the contents of all .zip, .jar, .ear, .war and .aar files in a directory tree. type: and get the most comprehensive listing of all files, all .zip (.jar etc) file contents
    and even zip contents embedded within other zips.

    Flexible file selection for zipping, using sfk:

    If you don’t want to zip all files of a directory tree, but for example

    • files that changed today, or since a date
    • files with a specific file extension
    • all files except those in subdirectories \save\ and \tmp\
    • files that are different compared to another directory

    then you have to prepare a file list with the swiss file knife, and send this to the zip tool through zip’s option -@ (read file list from standard input).

    example: zipping files changed today

    four files were changed today, so only those are packed into update.zip.

    example: including/excluding by filename

    only files with extension .txt are collected from the docs directory, excluding files
    • which are located in any subdirectory named «tmp»
    • having «-save.» in their name

    the example uses sfk for windows syntax. linux users have to type «:» instead of «!».

    example: comparing directories

    we have two directory trees, «docs» and «docs-old». the latter one is a copy of docs, made some days ago. meanwhile, there have been changes in «docs». but what changes?

    this command only lists what has changed so far:
    • some files have been added.
    • some files have differences, i.e. have been edited meanwhile.

    so let’s collect all these differences into a .zip. notice that zip would be irritated by the [add] and [dif] prefixes in each line, therefore we have to add sfk option -pure:

    now let’s send this to zip:

    NTFS and ZIP — execution prevention problem:

    i experienced one small problem when using the command-line (un)zip together with NTFS file systems; in short terms, after unzipping «.msi» files, I was unable to install software from these files. windows complained that access to the files was not possible or denied (due to some «execution prevention» mechanism introducted with XP SP2). this was probably because i zipped those files from a FAT partition (maybe even with an older zip tool) and then unzipped them on NTFS. the solution was to copy the files to a partition with FAT(32) file system, e.g. an USB stick, and then to run the installer from there.

    NTFS and ZIP — filetime jumps:

    another issue concerns filetimes, especially when zipping/unzipping accross FAT and NTFS partitions. in short terms, if you zip files from a FAT partition, then unpack this .zip on an NTFS partition, you always have to expect that the filetimes may be changed globally by a few hours. This is not at all a bug in the zip tool — it’s due to the way that NTFS manages filetimes internally. in case you’re irritated by this, try the following: 1) remember the filetimes in some directory on an NTFS partition. 2) change the date of your system from summer to winter time, or vice versa 3) have a look again at the filetimes and be shocked: all file times have jumped by one hour! so this is not a zip-specific problem, but it may show up when you compare times listed in a .zip file with those of the files actually created.

    Zip and unzip files

    Zipped (compressed) files take up less storage space and can be transferred to other computers more quickly than uncompressed files. In Windows, you work with zipped files and folders in the same way that you work with uncompressed files and folders. Combine several files into a single zipped folder to more easily share a group of files.

    Locate the file or folder that you want to zip.

    Press and hold (or right-click) the file or folder, select (or point to) Send to, and then select Compressed (zipped) folder.

    A new zipped folder with the same name is created in the same location. To rename it, press and hold (or right-click) the folder, select Rename, and then type the new name.

    Locate the zipped folder that you want to unzip (extract) files or folders from.

    Do one of the following:

    To unzip a single file or folder, open the zipped folder, then drag the file or folder from the zipped folder to a new location.

    To unzip all the contents of the zipped folder, press and hold (or right-click) the folder, select Extract All, and then follow the instructions.

    To add files or folders to a zipped folder you created earlier, drag them to the zipped folder.

    If you add encrypted files to a zipped folder, they’ll be unencrypted when they’re unzipped, which might result in unintentional disclosure of personal or sensitive information. For that reason, we recommend that you avoid zipping encrypted files.

    Some types of files, like JPEG images, are already highly compressed. If you zip several JPEG pictures into a folder, the total size of the folder will be about the same as the original collection of pictures.

    Windows: Zip/Unzip из Командной Строка

    В прошлом было невозможно создавать и распаковывать zip-архивы в Windows без установки сторонних программ, таких как WinZip и 7-Zip.

    Но теперь Windows имеет встроенную возможность архивирования файлов и папок и распаковки zip-архивов из командной строки с помощью PowerShell.

    Начиная с Windows 8 с PowerShell 3.0 и .NET Framework 4.5, установленных по умолчанию, из командной строки стало возможным выполнять своего рода команды zip и unzip .

    Дельный Совет: Скачать файл с помощью PowerShell! Читать далее →

    Zip/Unzip Из Командной Строки В Windows

    В зависимости от версии PowerShell существуют различные способы создания и распаковки zip-архивов из командной строки в Windows.

    Чтобы узнать версию PowerShell на вашей машине, выполните следующую команду:

    PowerShell 5.0 (Windows 10) и выше

    Начианя с PowerShell 5.0 (Windows 10), стало возможным создавать и распаковывать zip-архивы в Windows с помощью команд Compress-Archive and Expand-Archive в PowerShell.

    Сжать файл или папку из командной строки в Windows:

    Заархивировать все файлы в папке:

    Распаковать архив из командной строки в Windows:

    PowerShell 3.0 (Windows 8) и выше

    Начиная с PowerShell 3.0 (Windows 8), стало возможным создавать и распаковывать zip-архивы в Windows с помощью определенных методов в PowerShell.

    Сжать все файлы в папке из командной строки в Windows:

    Распаковать архив из командной строки в Windows:

    How to unzip a file using the command line? [closed]

    Want to improve this question? Update the question so it’s on-topic for Stack Overflow.

    Closed 8 years ago .

    Which commands can be used via the command line to unzip a file?
    Preferably something built into Windows or open source/free tools.

    10 Answers 10

    If you already have Java Development Kit on your PC and the bin directory is in your path (in most cases), you can use the command line:

    or if not in your path:

    Complete set of options for the jar tool available here.

    7-Zip, it’s open source, free and supports a wide range of formats.

    Firstly, write an unzip utility using vbscript to trigger the native unzip functionality in Windows. Then pipe out the script from within your batch file and then call it. Then it’s as good as stand alone. I’ve done it in the past for numerous tasks. This way it does not require need of third party applications, just the one batch file that does everything.

    Use it like this:

    As other have alluded, 7-zip is great.

    Note: I am going to zip and then unzip a file. Unzip is at the bottom.

    7-Zip Command Line Version

    You can put the following into a .bat file

    I’ve shown a few options.

    -r is recursive. Usually what you want with zip functionality.

    a is for «archive». That’s the name of the output zip file.

    -p is for a password (optional)

    -w is a the source directory. This will nest your files correctly in the zip file, without extra folder information.

    -mem is the encryption strength.

    There are others. But the above will get you running.

    NOTE: Adding a password will make the zip file unfriendly when it comes to viewing the file through Windows Explorer. The client may need their own copy of 7-zip (or winzip or other) to view the contents of the file.

    EDIT. (just extra stuff).

    There is a «command line» version which is probably better suited for this: http://www.7-zip.org/download.html

    So the zip command would be (with the command line version of the 7 zip tool).

    Now the unzip portion: (to unzip the file you just created)

    As an alternative to the «e» argument, there is a x argument.

    How can you zip or unzip from the script using ONLY Windows’ built-in capabilities?

    In Windows you can zip some files by

    right click → Send toCompressed (zipped) folder

    And unzip by double clicking on the .zip file and extract the files.

    Is there a way to apply those abilities from a script (.bat file) without the need to install any third-party software?

    17 Answers 17

    Back in 2013, that was not possible. Microsoft didn’t provide any executable for this.

    From Windows 8 on, .NET Framework 4.5 is installed by default, with System.IO.Compression.ZipArchive and PowerShell available, one can write scripts to achieve this, see https://stackoverflow.com/a/26843122/71312

    To expand upon Steven Penny’s PowerShell solution, you can incorporate it into a batch file by calling powershell.exe like this:

    As Ivan Shilo said, this won’t work with PowerShell 2, it requires PowerShell 3 or greater and .NET Framework 4.

    If you have Java installed, you can compress to a ZIP archive using the jar command:

    c = Creates a new archive file.

    M = Specifies that a manifest file should not be added to the archive.

    f = Indicates target file name.

    PowerShell 5.0

    Create result.zip from the entire Test folder:

    Extract the content of result.zip in the specified Test folder:

    It isn’t exactly a ZIP, but the only way to compress a file using Windows tools is:

    Advanced example (from ss64.com):

    Using 7-Zip:

    Zip: you have a folder foo , and want to zip it to myzip.zip

    Unzip: you want to unzip it ( myzip.zip ) to current directory ( ./ )

    100 machines in production which don’t have 7zip on them. To install that I would have to get the DevOps install it on all those machines and on all new machines that will be added to the clusters. I would rather avoid it. – Roee Gavirel May 9 ’16 at 5:27

    I’ve been looking to answer this exact question and from my research, DiryBoy’s response seems to be accurate.

    I found the compact.exe program compresses files but not to create a highly compressed file (or set of files). It is similar to the option you get when right clicking on a drive letter or partition in Windows. You get the option to do cleanup (remove temp files, etc) as well as compress files. The compressed files are still accessible but are just compressed to create space on a drive that is low on space.

    I also found compress.exe which I did happen to have on my computer. It isn’t natively on most windows machines and is part of the 2003 resource kit. It does make a zipped file of sorts but it is really more similar to files from a windows setup disk (has the underscore as the last character of the file extension or name). And the extract.exe command extracts those files.

    However, the mantra is, if it can be done natively via the GUI then there is likely a way to do it via batch, .vbs, or some other type of script within the command line. Since windows has had the ‘send to’ option to create a zip file, I knew there had to be a way to do it via command line and I found some options.

    Here is a great link that shows how to zip a file using windows native commands.

    I tested it with a directory containing multiple nested files and folders and it worked perfectly. Just follow the format of the command line.

    There is also a way to unzip the files via command line which I found as well. One way, just brings open an explorer window showing what the content of the zipped file is. Some of these also use Java which isn’t necessarily native to windows but is so common that it nearly seems so.

    Читайте также:  Error 1603 fatal error during installation consult windows installer help msi chm
  • Оцените статью