找回密码
 注册
搜索
系统gho:最纯净好用系统下载站投放广告、加入VIP会员,请联系 微信:wuyouceo
查看: 5764|回复: 6

[求助] 怎样利用7z.exe命令向压缩文件添加新文件?

[复制链接]
发表于 2014-5-3 14:33:40 | 显示全部楼层 |阅读模式
比如 1.zip 压缩文件里有 2 文件夹,怎样向 1.zip\2 文件夹里添加文件?试了好多命令都不行,能添加到 1.zip文件里,但添加不到 1.zip\2 文件夹里。请指导一下。

 楼主| 发表于 2014-5-3 20:53:11 | 显示全部楼层
7z.exe a 1.zip  D:\lock.jpg
这样可以打包到1.zip文件里,但无法打包到1.zip文件里的2文件夹下。

7z.exe a 1.zip\2  D:\lock.jpg
这样命令错误,找不到路径。

各位朋友帮帮忙,看怎么才能打包到 1.zip\2 文件夹里。
回复

使用道具 举报

发表于 2014-5-11 09:18:15 | 显示全部楼层
比较喜欢这类的资源 很喜欢看 ,谢谢楼主分享
回复

使用道具 举报

发表于 2014-5-12 22:26:25 | 显示全部楼层
Examples
7z a archive1.zip subdir\

adds all files and subfolders from folder subdir to archive archive1.zip. The filenames in archive will contain subdir\ prefix.

7z a archive2.zip .\subdir\*

adds all files and subfolders from folder subdir to archive archive2.zip. The filenames in archive will not contain subdir\ prefix.

cd /D c:\dir1\
7z a c:\archive3.zip dir2\dir3\

The filenames in archive c:\archive3.zip will contain dir2\dir3\ prefix, but they will not contain c:\dir1\ prefix.
7z a Files.7z *.txt -r

adds all *.txt files from current folder and its subfolders to archive Files.7z.


7z.exe a 1.zip   2\lock.jpg
使用绝对路径或\、.\开头的路径,路径前缀不会被包含在内。

点评

还是没弄明白, 向1.zip 压缩文件里的 2 文件夹添加一个3.js文件。能不能直接给一个命令?谢谢  详情 回复 发表于 2014-5-15 13:41
回复

使用道具 举报

 楼主| 发表于 2014-5-15 13:41:22 | 显示全部楼层
jneny 发表于 2014-5-12 22:26
7z.exe a 1.zip   2\lock.jpg
使用绝对路径或\、.\开头的路径,路径前缀不会被包含在内。

还是没弄明白, 向1.zip 压缩文件里的 2 文件夹添加一个3.js文件。能不能直接给一个命令?谢谢
回复

使用道具 举报

发表于 2014-5-15 18:31:17 | 显示全部楼层
  1. @echo off
  2. md 2 2>nul
  3. copy "%~0" 2\
  4. "D:\Program Files\7-Zip\7z.exe" a 1.zip "2\%~nx0"
  5. pause
复制代码
回复

使用道具 举报

 楼主| 发表于 2014-5-16 21:52:22 | 显示全部楼层
看来只能先建一目录,把需要添加的文件复制到目录才行。 我本想有没有像” 7z.exe a 1.zip\2  3.js “这样的命令,直接把3.js复制到2文件夹里。就像用copy那样的命令。看来不行。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1|闽公网安备35020302032614号 )

GMT+8, 2026-4-7 13:41

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表