使用批处理文件压缩文件夹中的所有文件和子目录
Zipping all files and subdirectories inside a folder using batch file
我编写了以下脚本来将所有文件和子目录压缩到一个文件夹中。但我只压缩了子目录。我在这里做错了什么?请指教
FOR /D %%i IN ("*") DO "C:\Program Files (x86)\WinRAR\WinRAR.exe" a ../../../apps-1.0.2.zip "%%~fi\"
试试这个例子并告诉我结果:
-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
编辑于 29/06/2016 @13:30
其他的开关和命令可以执行这个批处理打开Winrar的帮助文件:
@echo off
Set WinrarHelp=%ProgramFiles%\WinRAR\WinRAR.chm
Start "" "%WinrarHelp%"
我编写了以下脚本来将所有文件和子目录压缩到一个文件夹中。但我只压缩了子目录。我在这里做错了什么?请指教
FOR /D %%i IN ("*") DO "C:\Program Files (x86)\WinRAR\WinRAR.exe" a ../../../apps-1.0.2.zip "%%~fi\"
试试这个例子并告诉我结果:
-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
编辑于 29/06/2016 @13:30
其他的开关和命令可以执行这个批处理打开Winrar的帮助文件:
@echo off
Set WinrarHelp=%ProgramFiles%\WinRAR\WinRAR.chm
Start "" "%WinrarHelp%"