我正在尝试通过命令行为SSIS包压缩文件。我知道7-Zip是一个很好的开源工具,但我将部署的服务器也没有7-Zip。
我唯一拥有的工具是Windows Compress.exe和Compact.exe。 但是,在尝试此操作时,它似乎会创建无效/损坏的zip文件。
This is what I have tried:
Compress -z c:\test.xls c:\test.zip
Compress -zx c:\test.xls c:\test.zip
Compress c:\test.xls c:\test.zip
答案 0 :(得分:3)
DotNetZip包含可以包含在脚本中的命令行工具。 它适用于NTFS;)它是免费的,开源的。
c:\temp> zipit -?
Zipit.exe: zip up a directory, file, or a set of them, into a zipfile.
Depends on Ionic's DotNetZip library. This is version 1.8.2.13 of the utility.
usage:
ZipIt.exe <ZipFileToCreate> [arguments]
arguments:
-utf8 - use UTF-8 encoding for entries with comments or
filenames that cannot be encoded with the default IBM437
code page.
-aes - use WinZip-compatible AES 256-bit encryption for entries
subsequently added to the archive. Requires a password.
-sfx [w|c] - create a self-extracting archive, either a Windows or console app.
-64 - use ZIP64 extensions, for large files or large numbers of files.
-cp <codepage> - use the specified numeric codepage for entries with comments
or filenames that cannot be encoded with the default IBM437
code page.
-p <password> - apply the specified password for all succeeding files added.
use "" to reset the password to nil.
-c <comment> - use the given comment for the next file added to the archive.
-zc <comment> - use the given comment for the archive.
-d <path> - use the given directory path in the archive for
succeeding items added to the archive.
-s <entry> 'string' - insert an entry of the given name into the
archive, with the given string as its content.
-flat - store the files in a flat dir structure; do not use the
directory paths from the source files.
<directory> | <file> - add the directory or file to the archive.
答案 1 :(得分:1)
据我所知,compress.exe不是广泛使用的(PK-)Zip格式,而是在设置和cab文件中使用的MS特定压缩。
用它压缩的文件的扩展名曾经是._ ??,例如program._xe。