我有一个批处理,为par2档案创建WinRAR恢复文件。
但是不幸的是,只为存档xxx.part1.rar par2文件创建的批处理。
这是我用来压缩文件夹的行:
if "!FolderName:_UNPACK_=!" == "%%~nxF" (
"C:\Program Files\WinRAR\Rar.exe" m -ep1 -hp[password] -pxxx -mt5 -m1 -v50M -r "C:\Users\xxx\Desktop\xxx\%_RndAlphaNum%" "%%~F"
)这是我为RAR归档文件par2使用的行:
"C:\Program Files\xxx\phpar2.exe" c -r5 -b3000 "C:\Users\xx\Desktop\xxx\*.rar"发布于 2015-08-02 13:17:39
我不能重现任何问题。
在没有任何参数的情况下运行phpar2.exe会将帮助打印到命令提示符窗口中:
phpar2 version 1.3, Copyright (C) 2003 Peter Brian Clements.
phpar2 comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it and/or modify
it under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version. See COPYING for details.
Usage:
phpar2 c(reate) [options] <par2 file> [files] : Create PAR2 files
phpar2 v(erify) [options] <par2 file> [files] : Verify files using PAR2 file
phpar2 r(epair) [options] <par2 file> [files] : Repair files using PAR2 files
Options:
-b<n> : Set the Block-Count
-s<n> : Set the Block-Size (Don't use both -b and -s)
-r<n> : Level of Redundancy (%%)
-c<n> : Recovery block count (Don't use both -r and -c)
-f<n> : First Recovery-Block-Number
-u : Uniform recovery file sizes
-l : Limit size of recovery files (Don't use both -u and -l)
-n<n> : Number of recovery files (Don't use both -n and -l)
-m<n> : Memory (in MB) to use
-v [-v]: Be more verbose
-q [-q]: Be more quiet (-q -q gives silence)
-- : Treat all remaining CommandLine as filenames
If you wish to create par2 files for a single source file, you may leave
out the name of the par2 file from the command line.当应该同时为多个文件创建恢复数据时,建议为par2文件指定一个文件名(虽然没有必要)。
例如,当前目录为C:\Temp,目录C:\Temp\Test包含
Test.part01.rar
Test.part02.rar
Test.part03.rar
Test.part04.rar
Test.part05.rar
Test.part06.rar
Test.part07.rar
Test.part08.rar除了最后一个文件外,每个文件都有4MB,现在正在运行。
phpar2.exe c -r5 -b3000 "C:\Temp\Test\*.rar"由phpar2.exe打印到控制台窗口的输出是
Block size: 9784
Source file count: 7
Source block count: 3003
Redundancy: 5%
Recovery block count: 150
Recovery file count: 8
Opening: Test.part02.rar
Opening: Test.part03.rar
Opening: Test.part04.rar
Opening: Test.part05.rar
Opening: Test.part06.rar
Opening: Test.part07.rar
Opening: Test.part08.rar
Computing Reed Solomon matrix.
Constructing: done.
Wrote 1467600 bytes to disk
Writing recovery packets
Writing verification packets
Done另外,目录C:\Temp\Test还包含
Test.part01.rar.par2
Test.part01.rar.vol000+01.par2
Test.part01.rar.vol001+02.par2
Test.part01.rar.vol003+04.par2
Test.part01.rar.vol007+08.par2
Test.part01.rar.vol015+16.par2
Test.part01.rar.vol031+32.par2
Test.part01.rar.vol063+64.par2
Test.part01.rar.vol127+23.par2使用命令行
phpar2.exe c -r5 -b3000 TestRecovery.par2 "C:\Temp\Test\*.rar"phpar2.exe在当前目录C:\Temp中创建的文件包括
TestRecovery.par2
TestRecovery.vol000+01.par2
TestRecovery.vol001+02.par2
TestRecovery.vol003+04.par2
TestRecovery.vol007+08.par2
TestRecovery.vol015+16.par2
TestRecovery.vol031+32.par2
TestRecovery.vol063+64.par2
TestRecovery.vol127+23.par2这是正确的结果。
但是WinRAR支持将恢复数据直接添加到每个RAR文件或分离恢复卷文件。这可以通过使用WinRAR和命令rr (添加恢复数据)或rv (创建恢复卷)或直接使用存档创建选项-rr或-rv来完成。
对于批处理示例,用于为多卷存档的所有部分创建具有5%恢复数据的一个或多个单独恢复卷的命令行是:
"C:\Program Files\WinRAR\Rar.exe" m -cfg- -ep1 -hpPassword -inul -mt5 -m1 -r -rv5p -v50M "%USERPROFILE%\Desktop\xxx\%_RndAlphaNum%" "%%~F"注意:Rar.exe自动计算多卷存档的所有部分都需要具有5000万字节最大文件大小的恢复卷(50 MB将需要编写小写,即-v50m)。
有关恢复数据的更多详细信息,请阅读WinRAR的程序文件文件夹中的文本文件WinRAR,这是控制台版本Rar.exe的手册。
用于从命令行使用的GUI版本WinRAR.exe的命令和开关(批处理文件)包含在WinRAR中,请参阅在打开帮助-帮助主题之后,在帮助选项卡上的帮助主题,Content,在命令行模式下的项目。
Rar.exe或phpar2.exe是否为多卷存档的每个部分创建一个恢复文件。所创建的恢复文件包含多卷存档的所有部分的恢复数据。
https://stackoverflow.com/questions/31227164
复制相似问题