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-12 02:24
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Regarding using batch processing to associate WinRAR and extract files View 2,645 Replies 22
Original Poster Posted 2009-03-04 17:53 ·  中国 湖南 郴州 电信
初级用户
★★
Credits 87
Posts 61
Joined 2008-09-18 11:32
17-year member
UID 125941
Gender Male
Status Offline
Please provide the content that needs to be translated. Currently, the provided content is mostly in Chinese with some batch script code. Please clarify the specific part that needs to be translated. If it's the entire content, then it is as follows:

Please see the following:
The content in guanlian.bat:
@echo off
assoc.rar=rarfile
ftype rarfile="%programfiles%\winrar\jieyarar.bat" "%1" "%*"

assoc.zip=zipfile
ftype zipfile="%programfiles%\winrar\jieyazip.bat" "%1" "%*"

@echo off
title 正在解压....
echo 正在解压,如果文件较大,可能需要一点时间.
"%programfiles%\winrar\rar" x -y "*.rar" E:\临时下载存档区 >nul 2>nul
exit

This is the content in jieyarar.bat
@echo off
title 正在解压....
echo 正在解压,如果文件较大,可能需要一点时间.
"%programfiles%\winrar\rar" x -y "*.rar" E:\临时下载存档区 >nul 2>nul
exit

This is the content in jieyazip.bat
@echo off
title 正在解压....
echo 正在解压,如果文件较大,可能需要一点时间.
"%programfiles%\winrar\winrar" x -y "*.zip" E:\临时下载存档区 >nul 2>nul
exit

I originally only wanted to decompress the file that the user clicked, but I don't know how to get that variable. I tried %0 and %1
Neither worked, so I had to use *.zip and *.rar instead.
Now the problem is that every time I decompress a file, it decompresses all RAR or ZIP files in the current directory.
How can I only decompress the currently clicked file?
Floor 2 Posted 2009-03-05 18:38 ·  中国 湖南 郴州 电信
初级用户
★★
Credits 87
Posts 61
Joined 2008-09-18 11:32
17-year member
UID 125941
Gender Male
Status Offline
If there are any software or external programs that can decompress compressed files to a specified directory, that would also work.
Floor 3 Posted 2009-03-06 02:28 ·  中国 北京 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
Does it mean that all compressed files can only be extracted to one directory?

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 4 Posted 2009-03-06 02:33 ·  中国 北京 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
WINRAR -- Settings -- Compression -- Default Extraction Path

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 5 Posted 2009-03-06 09:21 ·  中国 湖南 郴州 电信
初级用户
★★
Credits 87
Posts 61
Joined 2008-09-18 11:32
17-year member
UID 125941
Gender Male
Status Offline
Hehe, what I mean is that as soon as you open a rar file or zip file, it will automatically extract to the specified directory, just like a self-extracting file.
Floor 6 Posted 2009-03-06 19:31 ·  中国 北京 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
-_-_- Then simply make a script to automatically convert RAR.ZIP to self-extracting.

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 7 Posted 2009-03-06 23:34 ·  中国 吉林 延边朝鲜族自治州 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
Originally posted by lisyofun at 2009-3-6 09:21:
Hehe, what I mean is that as soon as you open a rar file or a zip file, it will automatically extract to the specified directory, just like a self-extracting file.

Take using winrar.exe for extraction as an example.
First, suppose the file we want to compress and extract is 123.dat, and the expected extraction path is D:\hanye\guxing. First, we create these folders in sequence, then copy the 123.bat file to this directory, and compress it into 123.rar. The key is the compression options: when adding compression, select the rar compression format under "General", and under "Files" select "Store absolute path" or "Store full path including drive letter". Then delete the D:\hanye folder and its subfolders and all files inside.
When using the extraction command, use it as follows:
winrar.exe x -y "123.rar"
After running this, this 123.rar will be forcibly extracted to D:\hanye\guxing, and these directories will be created during extraction.
By the way, a few words of nonsense. For the compressed file created by the above method, when we use the GUI interface of winrar to extract, no matter which one we use, it will create a directory with an absolute path. For example, if you choose to extract to the current folder, a subdirectory D_\hanye\guxing will be generated inside the current folder.
As for what you said in floor 1 about extracting all files, that's because you used *.rar and *.zip.

[ Last edited by Hanyeguxing on 2009-3-7 at 00:02 ]
Floor 8 Posted 2009-03-06 23:44 ·  中国 吉林 延边朝鲜族自治州 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
I'm sorry, I didn't understand what you meant in the first floor. Do you want to make it so that double-clicking any.rar or.zip in your own machine will force it to decompress to a specified directory?

[ Last edited by Hanyeguxing on 2009-3-7 at 00:05 ]
Floor 9 Posted 2009-03-07 12:38 ·  中国 湖南 郴州 电信
初级用户
★★
Credits 87
Posts 61
Joined 2008-09-18 11:32
17-year member
UID 125941
Gender Male
Status Offline
Yes, what I mean is that as soon as the guest clicks on a rar or zip file, it will automatically extract to the fixed folder E:\Temporary Download Archive Area. Since the files are downloaded by the guest themselves, there's no way to make the guest create self-extracting archives by themselves. For example, if the guest just downloaded a 1.rar file, as soon as he opens it, it will automatically extract to the E:\Temporary Download Archive Area folder. Now my problem is that if the guest downloads two or more rar compressed files, as soon as he clicks, both will automatically extract to the E:\Temporary Download Archive Area, and I want it to extract separately, just like self-extracting archives. Also, if you don't use *.rar or *.zip, it simply can't be extracted.
Floor 10 Posted 2009-03-08 06:35 ·  美国 纽约州 威斯特彻斯特 白原市 Abovenet通信股份有限公司
中级用户
★★
Credits 216
Posts 129
Joined 2007-02-14 07:26
19-year member
UID 79469
Gender Male
Status Offline
It has a bit of the meaning of violating public opinion, and it's恐怕 not appropriate.

Wait, no, let's do it again. The correct translation should be: It has a bit of the meaning of going against public opinion, which I'm afraid is inappropriate.
Floor 11 Posted 2009-03-08 19:12 ·  中国 湖南 郴州 电信
初级用户
★★
Credits 87
Posts 61
Joined 2008-09-18 11:32
17-year member
UID 125941
Gender Male
Status Offline
Oh, we're in an internet cafe, of course we have our own considerations. Now we're discussing how to implement this function.

I added a line "del /f "*.zip" and del /f "*.rar" just now. Every time after decompression, the original files will be deleted. Although it's not perfect, it's still okay.
Floor 12 Posted 2009-03-11 16:28 ·  中国 北京 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
The `rar` command itself supports deleting the source file after decompression

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 13 Posted 2009-03-11 18:56 ·  中国 湖南 郴州 电信
初级用户
★★
Credits 87
Posts 61
Joined 2008-09-18 11:32
17-year member
UID 125941
Gender Male
Status Offline
I don't know how to only extract the compressed file that the user clicks on.
Floor 14 Posted 2009-03-12 20:49 ·  中国 北京 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
I have an idea.
I'm too lazy to install a virtual machine.
Do you have a test environment that can be logged in remotely?

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 15 Posted 2009-03-12 21:57 ·  中国 北京 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
In Folder Options - File Types - RAR, click Advanced, and change it to "C:\Program Files\WinRAR\unrar.exe" x -o+ -y "%1" E:\Temporary Download Archive Area\
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
lisyofun +2 2009-03-13 11:25

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Forum Jump: