China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-02 06:45
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Inquiry] How to repair a rar file from a batch process? View 2,328 Replies 10
Original Poster Posted 2006-09-23 23:03 ·  中国 广东 东莞 电信
初级用户
Credits 42
Posts 15
Joined 2006-09-10 02:05
19-year member
UID 62260
Gender Male
From 广东省
Status Offline
Which expert can help? How can we implement the function of repairing damaged RAR archive files in batch processing? Thanks a lot..



————————————I am the divider——————————————


*********************************
Board affairs record
*********************************
Operation: Change title
Reason: Original format does not conform to forum rules
Original title: Help... I don't know if batch processing can do it..
Execution: 3742668
Punishment: First offense, forgiven.
Remarks: 1. It is recommended to read the sticky forum rules before posting
2. How to change the title?
Click the Edit button at the bottom right corner of the posted thread, then edit it.
3. DOS batch processing & script technology
(Batch processing room) Forum rules (draft)

**********************************


[ Last edited by qwe1234567 on 2006-10-1 at 04:34 ]
Floor 2 Posted 2006-09-24 00:55 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
r Repair damaged archive. Archive repair is done in two phases. First, it searches for recovery records in the damaged archive (refer to the 'rr' command). If the archive contains recovery records, and the damaged data part is contiguous and less than N*512 bytes (where N is the number of recovery blocks placed in the archive), the chance of successfully repairing the archive is very high. When this phase is completed, a new archive will be created, named _RECOVER.RAR.

If the damaged archive does not contain recovery records or if the archive is not fully repaired resulting in major damage, the second phase will be executed. During this phase, only the structure of the archive is reconstructed, and it is impossible to recover files with CRC errors. It may still recover undamaged files due to structural corruption. This is usually useful for non-solid archives.

When the second phase is completed, the reconstructed archive will be saved as rebuilt.arcname.rar, where 'arcname' is the original archive name.

RAR/DOS32 versions use _recover.rar and _reconst.rar instead of the names mentioned above.

During the recovery record process, RAR can prompt the user when suspicious files are found.

Suspicious item

Name: <possible file name>
Size: <size> Compressed: <compressed size>

Add it: yes/no/all

Answer 'y' to add this item to the file _RECOVER.RAR.

Example:

rar r buggy.rar


rc Rebuild missing volumes using recovery volumes (.rev files). You need to specify any existing volume as the archive name, for example, 'rar rc backup.part03.rar'

Read the 'rv' command description for information about recovery volumes.
第一高手 第二高手

Floor 3 Posted 2006-09-25 21:18 ·  中国 广东 广州 荔湾区 电信
初级用户
Credits 42
Posts 15
Joined 2006-09-10 02:05
19-year member
UID 62260
Gender Male
From 广东省
Status Offline
Thanks to the friend above, I have also searched for the repair method you mentioned above on the Internet and have some understanding. But I just want to complete the repair action through batch processing running automatically in the background. I wonder if it can be realized.
Floor 4 Posted 2006-09-28 22:06 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
start /min "C:\Program Files\WinRAR\rar.exe" r -inul buggy.rar
第一高手 第二高手

Floor 5 Posted 2006-09-28 23:14 ·  中国 广东 广州 天河区 电信
初级用户
Credits 42
Posts 15
Joined 2006-09-10 02:05
19-year member
UID 62260
Gender Male
From 广东省
Status Offline
May I ask the person above.. How is this used?
Floor 6 Posted 2006-09-30 21:58 ·  中国 广东 东莞 电信
初级用户
Credits 42
Posts 15
Joined 2006-09-10 02:05
19-year member
UID 62260
Gender Male
From 广东省
Status Offline
Where are the experts... This problem has puzzled me for a long time... Please help... Thank you thank you
Floor 7 Posted 2006-09-30 23:13 ·  中国 广东 东莞 电信
初级用户
Credits 42
Posts 15
Joined 2006-09-10 02:05
19-year member
UID 62260
Gender Male
From 广东省
Status Offline
The code I found online.. but I can't write a batch script... Can anyone help... Write a batch script to repair RAR.

After installing WinRAR, you will find a file rar.exe in the same directory. It is also the Windows version of 32-bit RAR, but it only supports the command line, a text-mode interface. It is especially useful when calling and controlling RAR and so on from BAT and CMD files in the DOS prompt mode. It supports many more command-line parameter switches and commands than WinRAR. Although it has a similar syntax to the conventional command-line WinRAR command-line interface, it is a real RAR console program. This help file does not contain descriptions of those switch parameters and commands supported only in the console version. You can read the rar.txt file to get detailed help on all console RAR functions.


Usage: rar <command> -<switch 1> -<switch N> <archive file> <file...>
<@list files...> <extract path\>

<command>
a Add files to archive
c Add archive comment
cf Add file comment
cw Write archive comment to file
d Delete files from archive
e Extract files to current directory
f Refresh files in archive
i=<string> Find string in archive
k Lock archive
l List archive
m Move to archive
p Print file to standard output device
r Repair archive
rc Rebuild missing volumes
rr Add data recovery records
rv Create recovery volumes
s Convert archive to self-extracting format or convert back to archive
t Test archive
u Update files in archive
v List archive in detail
x Extract files with absolute path

<switch>
- Stop scanning
ac Clear file attributes after compression or extraction
ad Add archive name to target path
ag Generate archive name using current date
ao Add files with archive attributes
ap<format> Add path to archive
as Synchronize archive contents
av Add user verification (available only in registered version)
av- Disable user verification
c- Disable comment display
cfg- Disable reading configuration
cl Convert names to lowercase
cu Convert names to uppercase
df Delete files after compression
dh Open shared files
ds Disable name sorting for solid archives
e<attribute> Set file exclusion attribute
ed Do not add empty directories
en Do not add "archive end" flag
ep Exclude path from name
ep1 Exclude base directory from name
ep2 Expand to full path
f Refresh files
hp Encrypt both file data and file header
idp Disable percentage display
ieml Send archive via E-mail
ierr Send all messages to standard error device
ilog Write errors to log file (available only in registered version)
inul Disable all messages
ioff Turn off PC power after one operation
isnd Enable sound
k Lock archive
kb Keep damaged extracted files
m<0..5> Set compression level (0=store...3=default...5=maximum)
mc<parameter> Set advanced compression parameters
md<size> Dictionary size in KB (64, 128, 256, 512, 1024, 2048, 4096 or A-G)
ms Specify file types to store
o+ Overwrite existing files
o- Do not overwrite existing files
os Save NTFS streams
ow Save or restore file owner and group
p Set password
p- Do not ask for password
r Recurse subdirectories
r0 Recurse only subdirectories with wildcard names

[ Last edited by cranelulu on 2006-10-1 at 00:01 ]
Floor 8 Posted 2006-10-01 04:31 ·  中国 四川 南充 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
───────────────── Moderation Record ─────────────────
Performed by: qwe1234567
Description: The original threads { Code found online.. Can someone help... Write a batch script to repair RAR} and { How to repair RAR files from a batch script} have a contextual relationship
Tip: Please do not post the same question in several threads, as it is not conducive to management and replying!
Action: Merge the threads and delete the post with the same content posted by cranelulu on floor 7 in the original { How to repair RAR files from a batch script}!
Punishment: Deduct 4 points for the extra points obtained from posting multiple threads
───────────────── Moderation Record ─────────────────


[ Last edited by qwe1234567 on 2006-10-1 at 04:42 ]
Floor 9 Posted 2006-10-01 11:11 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
Originally posted by cranelulu at 2006-9-28 23:14:
How to use this sentence above?


In batch processing, for .bat or .cmd, use....

@echo off
path=%path%;C:\Program Files\WinRAR;
start /min rar.exe r -inul Here is the name of the RAR file you need to repair
第一高手 第二高手

Floor 10 Posted 2006-10-01 11:14 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
Two old guys, it seems we need to communicate. There are 3 version operations in one post...
Floor 11 Posted 2006-10-01 11:37 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Hehe, that was merged from another topic by qwe1234567, so it's like that. I've already deleted my moderation record.

Just took office not long ago, and I still need to get familiar with the forum management operations. Please bear with me.

[ Last edited by namejm on 2006-10-1 at 11:40 ]
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Forum Jump: