使用 Windows 11 从命令行进行 Zip

Bla*_*izz -1 zip cmd windows-11

使用新的 Windows 11 功能压缩文件的 cmd 工具是什么?(资源管理器默认使用的)。我尝试过 zip、7zip、压缩...

谢谢

K J*_*K J 10

在较新的Windows 10上用于 zip 处理的 CMD 工具,因此我认为延续到 Win 11 的是TAR,但它不是“资源管理器中默认使用的工具”,因为该系统内置功能已经存在,因为我认为,在最少 XP"

Windows系统使用bsdtar的变种

[bsd] TAR 创建和操作流归档文件。此实现可以从 tar、pax、cpio、zip、jar、ar、xar、rpm、7-zip 和 ISO 9660 cdrom 映像中提取,并可以创建 tar、pax、cpio、ar、zip、7-zip 和共享档案。

不过,我还没有测试 Windows 版本是否包含所有其他格式,例如 7-zip,但 zip 运行良好。

Tar -h

tar(bsdtar): manipulate archive files
First option must be a mode specifier:
  -c Create  -r Add/Replace  -t List  -u Update  -x Extract
Common Options:
  -b #  Use # 512-byte records per I/O block
  -f <filename>  Location of archive (default \\.\tape0)
  -v    Verbose
  -w    Interactive
Create: tar -c [options] [<file> | <dir> | @<archive> | -C <dir> ]
  <file>, <dir>  add these items to archive
  -z, -j, -J, --lzma  Compress archive with gzip/bzip2/xz/lzma
  --format {ustar|pax|cpio|shar}  Select archive format
  --exclude <pattern>  Skip files that match pattern
  -C <dir>  Change to <dir> before processing remaining files
  @<archive>  Add entries from <archive> to output
List: tar -t [options] [<patterns>]
  <patterns>  If specified, list only entries that match
Extract: tar -x [options] [<patterns>]
  <patterns>  If specified, extract only entries that match
  -k    Keep (don't overwrite) existing files
  -m    Don't restore modification times
  -O    Write entries to stdout, don't restore to disk
  -p    Restore permissions (including ACLs, owner, file flags)
bsdtar 3.5.2 - libarchive 3.5.2 zlib/1.2.5.f-ipp
Run Code Online (Sandbox Code Playgroud)

列出用途Tar -tf file.zip

提取使用Tar -m -xf file.zip

压缩使用Tar -a -cf new.zip files

其他选项可用,如上所示。