使用批处理文件荏苒一个文件夹内的所有文件和子目录 [英] Zipping all files and subdirectories inside a folder using batch file
问题描述
我写了下面的脚本来压缩文件夹内的所有文件和子目录。但我只得到压缩的子目录。我在做什么错在这里?请指点。
FOR / D %%我(*)DOC:\\ Program Files文件(x86)的\\ WinRAR的\\的WinRAR.exe一个../../ .. /apps-1.0.2.zip%%〜科幻\\
试用一下这个例子,告诉我的结果:
-R开关:对于经常性的子文件夹
-AF
<类型和GT;
开关:指定归档格式
-EP1开关:排除基本文件夹的名称
-dh开关:打开共享文件:可以处理其他应用程序打开的文件。
此开关是有用的,如果一个应用程序允许访问文件的读取,但如果所有的访问被禁止,打开文件总是失败。
块引用>关闭@echo
设置用Winrar =的%ProgramFiles%\\ WinRAR的\\的WinRAR.exe
设置MyFolder中=%USERPROFILE%\\收藏
设置ArchiveName = apps-1.0.2.zip
%的Winrar%一-r -afzip -ep1 -dh%ArchiveName%%MyFolder文件%
暂停上的编辑29/06/2016 @ 13:30
有关其他交换机和命令可以执行此批处理打开WinRAR的帮助文件:
关闭@echo
设置WinrarHelp =的%ProgramFiles%\\ WinRAR的\\ WinRAR.chm
启动%WinrarHelp%I wrote the below script to zip all the files and sub directories inside a folder. But I am only getting the sub directories zipped. What am I doing wrong here? Please advice.
FOR /D %%i IN ("*") DO "C:\Program Files (x86)\WinRAR\WinRAR.exe" a ../../../apps-1.0.2.zip "%%~fi\"
解决方案Give a try for this example and tell me the results :
-R Switch : for recurring subfolders
-AF
<Type>
Switch : specify the archive format-EP1 Switch : to exclude the names of the basic folder
-DH Switch: open shared files : Can process files opened by other applications. This switch is useful if an application allows access the file read, but if all access is prohibited, the file open always fail.
@echo off Set Winrar=%ProgramFiles%\WinRAR\WinRAR.exe Set MyFolder=%USERPROFILE%\Favorites Set ArchiveName=apps-1.0.2.zip "%Winrar%" a -r -afzip -ep1 -dh "%ArchiveName%" "%MyFolder%" pause
Edit on 29/06/2016 @13:30
For others switchs and commands you can execute this batch to open the help file of Winrar :
@echo off Set WinrarHelp=%ProgramFiles%\WinRAR\WinRAR.chm Start "" "%WinrarHelp%"
这篇关于使用批处理文件荏苒一个文件夹内的所有文件和子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!