无忧启动论坛

标题: 怎样利用7z.exe命令向压缩文件添加新文件? [打印本页]

作者: yinyuan    时间: 2014-5-3 14:33
标题: 怎样利用7z.exe命令向压缩文件添加新文件?
比如 1.zip 压缩文件里有 2 文件夹,怎样向 1.zip\2 文件夹里添加文件?试了好多命令都不行,能添加到 1.zip文件里,但添加不到 1.zip\2 文件夹里。请指导一下。


作者: yinyuan    时间: 2014-5-3 20:53
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
比较喜欢这类的资源 很喜欢看 ,谢谢楼主分享
作者: jneny    时间: 2014-5-12 22:26
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
使用绝对路径或\、.\开头的路径,路径前缀不会被包含在内。
作者: yinyuan    时间: 2014-5-15 13:41
jneny 发表于 2014-5-12 22:26
7z.exe a 1.zip   2\lock.jpg
使用绝对路径或\、.\开头的路径,路径前缀不会被包含在内。

还是没弄明白, 向1.zip 压缩文件里的 2 文件夹添加一个3.js文件。能不能直接给一个命令?谢谢
作者: pznpt    时间: 2014-5-15 18:31
  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
复制代码

作者: yinyuan    时间: 2014-5-16 21:52
看来只能先建一目录,把需要添加的文件复制到目录才行。 我本想有没有像” 7z.exe a 1.zip\2  3.js “这样的命令,直接把3.js复制到2文件夹里。就像用copy那样的命令。看来不行。





欢迎光临 无忧启动论坛 (http://bbs.c3.wuyou.net/) Powered by Discuz! X3.3