Windows copy to zip file
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.
- 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.
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
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:
|
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
Поддержка всех форматов архивации
Выбор темы оформления программы
Полностью бесплатное использование
Сочетание функций и стиля
WindowsZIP – сочетание высокой производительности, небольшого веса и продуманного дизайна. Речь идет об удобной утилите для архивации текстов, музыки, видеороликов, фото, различного софта. Привлекает обширным функционалом и детализированным интерфейсом.
Приложение содержит 15 разных стилей, каждый из которых вы можете оценить в настройках — все варианты предполагают уникальное оформление! При этом приложение привлекает интуитивно понятным меню. Посредством нескольких кликов можно добавить и удалить архив, извлечь данные и проверить файлы на наличие вирусов.
Управление бесплатной программой для Windows предусматривает работу, как с окном приложения, так и готовыми архивами. Вы можете создать папку и перетащить в нее необходимые файлы или осуществить действия посредством работы в приложении. Для этого нужно нажать на вкладку «добавить» и указать путь к интересующим элементам.
Богатый функционал
WindowsZIP привлекает обширным набором функций для создания, конвертации и редактирования архивов. С помощью данного приложения можно установить пароль, изменить вес и придумать название для файла. Можно совместить несколько архивов в один, выполнить сжатие для экономии места, зашифровать данные и скрыть папки.
Если не хотите «заморачиваться» можно поставить галочку возле функции «Создать само-распаковывающийся архив», который предполагает наличие настроек по умолчанию. Также есть режим, позволяющий автоматически прикреплять к названию файла дату и время создания.
Поддержка всех форматов
Посредством менеджера расширения файлов, вы можете выбрать, в каком формате сохранить архив. Доступно более 20 вариаций, включая:
WindowsZIP предусматривает открытие любых архивов, даже которые создавались посредством портативных устройств. Более того вы можете создать и изменить папки на ПК под разные операционные системы, включая Андроид и прочее.
Создавать.zip папка из командной строки- (Windows)
можно ли создать .zip-файл из папки в командной строке, я не хочу использовать какой-либо исполняемый файл третьей стороны.
Я думал что-то вроде ‘отправить в сжатую папку’, но я не знаю как это сделать.
10 ответов
начиная с PowerShell 5 (Февраль 2016), вы можете использовать «Compress-Archive»:
Я не думаю, что есть командная строка для ZIP-файлов, встроенных в Windows (кроме compress в Server 2003 Resource Kit). Вам придется использовать третью сторону. Все любят в 7-Zip!
Я объединил этот скрипт из нескольких разных источников, чтобы лучше удовлетворить мои потребности. Скопируйте и вставьте скрипт в файл с расширением».vbs». Сценарий был первоначально сделан для Windows XP, Но он также работает в Windows 7 x64 Ultimate — нет гарантии, Если Windows будет держать вокруг различных объектов оболочки, которые это использует.
использование: в поле Выполнить или командной строки положить —
путь к скрипту, исходная папка, zip-файл, чтобы сделать (include .zip в конец.)
он не будет копировать пустые папки, поэтому будьте осторожны.
вот отличная ссылка, которая показывает, как заархивировать файл с помощью собственных команд windows.
Я проверил его с каталогом, содержащим несколько вложенных файлов и папок, и он работал отлично. Просто следуйте формату командной строки.
существует также способ распаковать файлы через командную строку, которую я нашел. Один путь, как раз приносит откройте окно Проводника, показывающее содержимое zip-файла. Некоторые из них также используют Java, который не обязательно является родным для windows, но настолько распространен, что это почти кажется.
Это старый вопрос, но актуальности до сих пор.
Windows, конечно, имеет свой собственный алгоритм сжатия, встроенный для использования zip-файлов, но он действительно плохо работает по сравнению с продуктом с открытым исходным кодом 7zip, найденным здесьhttp://www.7-zip.org/
другие уже обсуждали различные методы использования встроенных функций windows, мое решение требует установки дополнительного программного обеспечения.
7Zip поддерживает широкий спектр файлов, включая ZIP, RAR, CAB и ISO, а также собственный формат 7z.
вы можете просмотреть справку командной строки: «Files\7-Zip\7z.exe C:\Program» —помочь
для простого добавления в zip архив:
«C:\Program Files\7-Zip\7z.exe» имени.zip c:\path
я опубликую что-то связанное с WSkids ответ, К сожалению, я не могу использовать функцию комментария.
С помощью метода CopyHere() в VBS возникает несколько проблем. Одна из этих проблем заключается в том, что метод немедленно возвращается, когда процесс копирования начинается в фоновом режиме, тогда как несколько вызовов CopyHere() будут мешать друг другу, и ZIP не будет создан правильно. Цикл ожидания необходим здесь, чтобы исправить это. Мой цикл ожидания основан на ответе на аналогичную проблему опубликовано здесь.
вот обновленная версия, которая исправляет ошибку» требуется объект», о которой сообщает pihentagy. Это проблема синхронизации, так как вновь созданный ZIP-файл включается в коллекцию Items, когда сценарий выполняется на быстрых машинах.