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-04 21:33
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Please tell me how to use the RAR command to compress files of specified types? View 1,814 Replies 13
Original Poster Posted 2007-05-14 13:51 ·  中国 湖南 衡阳 电信
中级用户
★★
Credits 322
Posts 144
Joined 2007-01-10 13:00
19-year member
UID 76062
Gender Male
Status Offline
How to use the command to compress all *.TXT and *.LOG files under c:\windows with RAR?

I saw that the usage of RAR seems not to have this function~

Does it have to write these files to a file first and then compress with RAR?

May I ask what should I do?
Floor 2 Posted 2007-05-14 14:13 ·  中国 湖南 衡阳 电信
中级用户
★★
Credits 322
Posts 144
Joined 2007-01-10 13:00
19-year member
UID 76062
Gender Male
Status Offline
Does anyone know? I'm really urgent!
Floor 3 Posted 2007-05-14 15:13 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
```
rar a temfile.rar C:\windows\*.txt C:\windows\*.log
```
Floor 4 Posted 2007-05-17 12:41 ·  中国 湖南 衡阳 电信
中级用户
★★
Credits 322
Posts 144
Joined 2007-01-10 13:00
19-year member
UID 76062
Gender Male
Status Offline
Floor 5 Posted 2007-05-25 12:29 ·  中国 湖南 衡阳 电信
中级用户
★★
Credits 322
Posts 144
Joined 2007-01-10 13:00
19-year member
UID 76062
Gender Male
Status Offline
Prompt me, no file啊
Floor 6 Posted 2007-05-25 13:20 ·  中国 江苏 连云港 电信
高级用户
★★★
前进者
Credits 641
Posts 303
Joined 2007-01-10 02:57
19-year member
UID 76009
Gender Male
Status Offline
If it doesn't succeed, it means there is no such file in the Windows directory. If the original poster means that all *.txt and *.log in the Windows directory including its subdirectories still need to use the for command to do it. Or use the command to search first, direct to the list file, and use the list file to do it.
我相信总有一天,总会遇到一个人可以相濡以沫、相吻以湿!
Floor 7 Posted 2007-05-25 16:49 ·  中国 湖南 衡阳 电信
中级用户
★★
Credits 322
Posts 144
Joined 2007-01-10 13:00
19-year member
UID 76062
Gender Male
Status Offline
"C:\WINDOWS" means including files in subdirectories, and there may be files with the same name. For example, C:\WINDOWS\a\a.txt and C:\WINDOWS\b\a.txt. Will it overwrite the original files when packaging?
Floor 8 Posted 2007-05-27 14:27 ·  中国 江苏 连云港 联通
高级用户
★★★
前进者
Credits 641
Posts 303
Joined 2007-01-10 02:57
19-year member
UID 76009
Gender Male
Status Offline
dir/s/b/a-d %windir%\*.txt>list.txt
dir/s/b/a-d %windir%\*.log>>list.txt
rar a a @list.txt
Take a look inside a.rar, and it will contain all .txt and .log files in the Windows directory.
我相信总有一天,总会遇到一个人可以相濡以沫、相吻以湿!
Floor 9 Posted 2007-05-28 10:46 ·  中国 安徽 合肥 电信
初级用户
Credits 109
Posts 42
Joined 2007-05-12 09:38
19-year member
UID 88253
Gender Male
Status Offline
Floor 10 Posted 2007-05-28 11:19 ·  中国 广东 深圳 电信
初级用户
★★
Credits 135
Posts 61
Joined 2007-04-14 09:23
19-year member
UID 85115
Gender Male
Status Offline
What you said upstairs is very comprehensive. It's more detailed than what I collected. Hehe. Collect it again.
Floor 11 Posted 2007-05-29 17:51 ·  中国 湖南 衡阳 电信
中级用户
★★
Credits 322
Posts 144
Joined 2007-01-10 13:00
19-year member
UID 76062
Gender Male
Status Offline
I've been running naked for a few years.
Hehe``

Thanks for the guidance from yjq635.
I'll change my username and give you more points later.
Floor 12 Posted 2007-05-29 17:56 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
The explanation on floor 9 is in the Rar.txt file in the WinRar installation folder.
Floor 13 Posted 2007-06-01 14:09 ·  中国 北京 联通
初级用户
Credits 20
Posts 12
Joined 2007-06-01 12:47
19-year member
UID 89957
Gender Male
Status Offline
"C:\Program Files\WinRAR\WinRAR.exe" a -ep2 -ibck -agyyyymmdd d:\qsbak\qssj.rar @d:\qsbak\qsback.lst

The location and file name after compression: d:\qsbak\qssj.rar
Create a text file: qsback.lst, which contains the list of files to be compressed
Z:\dbf\*.zip
Z:\dbf\zqjsxx.*
Z:\dbf\sh.dbf
Floor 14 Posted 2007-06-01 14:12 ·  中国 北京 联通
初级用户
Credits 20
Posts 12
Joined 2007-06-01 12:47
19-year member
UID 89957
Gender Male
Status Offline
The location and file name after compression: d:\qsbak\qssjyyyymmdd.rar, for example, qssj20070531.rar
Forum Jump: