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-03 17:11
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to batch extract RAR files with the same password? View 2,679 Replies 17
Original Poster Posted 2007-03-08 14:29 ·  中国 新疆 喀什地区 电信
初级用户
Credits 28
Posts 12
Joined 2007-03-08 14:00
19-year member
UID 81093
Gender Male
Status Offline

─────────────────── Moderation Record ────────────────────
Performed by: namejm
Original Title: Request for a batch command
Description: The title is too vague, which is not convenient for forum search and management. Please modify the title within three days.
Prompt: To modify the title, click Edit at the bottom right of the current post, and then click Edit Post after modification.
Punishment: Since it is a new forum user, no punishment is temporarily given; if the title is not modified after three days, 2 points will be deducted as a punishment, and the moderator will forcibly modify the title. Please click here to read the forum posting regulations to avoid violating posting regulations in future discussions.
─────────────────── Moderation Record ────────────────────

I need to extract all compressed files in a folder (for example, the d:\txe directory, which has thousands of compressed files in the directory) to a specified directory (for example, e:\temp\01). (All compressed files in the folder need to be password-protected, and the passwords are all the same.) How should this be written?

[ Last edited by zhaoxianqunks on 2007-3-10 at 12:07 AM ]
Floor 2 Posted 2007-03-08 14:45 ·  中国 浙江 绍兴 诸暨市 电信
高级用户
★★★
Autowalk
Credits 845
Posts 375
Joined 2007-03-03 01:58
19-year member
UID 80606
Gender Male
Status Offline
echo off
cd /d "C:\Program Files\WinRAR" & winrar e e:\11\*.rar e:\22

The -p switch is only available for setting a password when adding files to a RAR archive, not for entering a password when extracting. You need to input it manually.

The above code only extracts when the RAR has no password
Floor 3 Posted 2007-03-08 14:54 ·  中国 新疆 喀什地区 电信
初级用户
Credits 28
Posts 12
Joined 2007-03-08 14:00
19-year member
UID 81093
Gender Male
Status Offline
There is a fixed password. How to use it?
Floor 4 Posted 2007-03-08 14:55 ·  中国 新疆 喀什地区 电信
初级用户
Credits 28
Posts 12
Joined 2007-03-08 14:00
19-year member
UID 81093
Gender Male
Status Offline
I see a post that is written like this:
for /d %%d in (%1.*.*) do "%ProgramFiles%.\WinRAR\rar" a -r -m0 -inul %1."%%~nxd.rar" "%%~nxd"
for %%f in (%1.*.*) do "%ProgramFiles%.\WinRAR\rar" a -r -m0 -inul %1."%%~nf.rar" "%%~nxf"
Floor 5 Posted 2007-03-08 22:18 ·  中国 湖北 武汉 电信
初级用户
Credits 22
Posts 10
Joined 2007-02-16 22:46
19-year member
UID 79647
Gender Male
Status Offline
winrar e -ppassword a.rar c:\test\

-p is the switch to enter the password, followed by the password

[ Last edited by test266 on 2007-3-8 at 09:19 AM ]
Floor 6 Posted 2007-03-09 04:09 ·  中国 新疆 喀什地区 电信
初级用户
Credits 28
Posts 12
Joined 2007-03-08 14:00
19-year member
UID 81093
Gender Male
Status Offline
For example, the password is 99999, then how should it be written? Please give a complete batch script, thank you!
Floor 7 Posted 2007-03-10 00:03 ·  中国 浙江 绍兴 电信
高级用户
★★★
Autowalk
Credits 845
Posts 375
Joined 2007-03-03 01:58
19-year member
UID 80606
Gender Male
Status Offline
echo off
cd /d "C:\Program Files\WinRAR" & winrar e -p99999 e:\11\*.rar e:\22

According to what the 5th floor said,
Floor 8 Posted 2007-03-10 00:41 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
I need to extract all compressed files in a folder to a specified directory. (All compressed files in the folder need a password, and the passwords are all the same.) How should this be written?


  "Extract all compressed files in a folder". Which folder's compressed files are we talking about?
  
  "Extract to a specified directory". Which directory exactly?

  "The passwords are all the same". What is the password?

  Don't you expect the person writing code to help you assume which folder's compressed files they are? Others would have to assume the folder, assume an extraction directory, and assume a password. Would others spend a lot of time assuming for you? Take a close look here: http://www.cn-dos.net/forum/viewthread.php?tid=1415&fpage=1
Floor 9 Posted 2007-03-10 10:52 ·  中国 新疆 喀什地区 电信
初级用户
Credits 28
Posts 12
Joined 2007-03-08 14:00
19-year member
UID 81093
Gender Male
Status Offline
Administrator, I'm new here. I don't know if I meet the requirements now. Is it because of my expression ability? If it's still not okay, please delete it. Thank you.
Floor 10 Posted 2007-03-10 10:56 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Personal suggestion: The title is:

How to batch extract RAR files with the same password?

My title is more informative than the information upstairs of yours?

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 11 Posted 2007-03-10 12:54 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline

@echo off
for /r d:\txe %%a in (*.rar *.zip) do (
rar x -p1234567 "%%a" "e:\temp\01"
)

  Not tested, try this, post if there are issues.

  Also, please note that future posts should have titles indicating the general content. Change the title to what brother electronixtar mentioned above.

Floor 12 Posted 2007-03-10 13:06 ·  中国 新疆 喀什地区 电信
初级用户
Credits 28
Posts 12
Joined 2007-03-08 14:00
19-year member
UID 81093
Gender Male
Status Offline
Thanks to the person above. I don't know if there's a problem with my modification. The test prompt on the 7th floor said that the compressed file wasn't found. I'll post the actually modified code:
echo off
cd /d "C:\Program Files\WinRAR" & winrar e -ptxtdown.com F:\小说\111111\txtdown.com\*.rar F:\小说\111111\txtdown.com
Note: The actual path on my hard drive is: F:\小说\111111\txtdown.com (There are about 7,000 compressed files in the folder named txtdown.com, and the extraction password is: txtdown.com)
The prompt on the 11th floor isn't the correct command. The modification is as follows:
@echo off
for /r F:\小说\111111\txtdown.com %%a in (*.rar *.zip) do (rar x -ptxtdown.com "%%a" F:\小说\111111\txtdown.com")
Everyone, help me see where the error is? Thanks

[ Last edited by zhaoxianqunks on 2007-3-10 at 12:27 AM ]
Floor 13 Posted 2007-03-10 13:28 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline

  Re zhaoxianqunks:

  Please post your code for us to see.
Floor 14 Posted 2007-03-10 13:42 ·  中国 新疆 喀什地区 电信
初级用户
Credits 28
Posts 12
Joined 2007-03-08 14:00
19-year member
UID 81093
Gender Male
Status Offline
@echo off
for /r F:\小说\111111\txtdown.com %%a in (*.rar *.zip) do (rar x -ptxtdown.com "%%a" F:\小说\111111\txtdown.com")

My QQ:290260605 After correct processing, I will post it.

[ Last edited by zhaoxianqunks on 2007-3-10 at 12:45 AM ]
Floor 15 Posted 2007-03-10 13:55 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline

  Re zhaoxianqunks:

  What specific error is it? It's best to take a screenshot and show it.
Forum Jump: