![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-12 03:17 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » Regarding using batch processing to associate WinRAR and extract files |
| Printable Version 2,648 / 22 |
| Floor1 lisyofun | Posted 2009-03-04 17:53 |
| 初级用户 Posts 61 Credits 87 | |
|
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? |
|
| Floor2 lisyofun | Posted 2009-03-05 18:38 |
| 初级用户 Posts 61 Credits 87 | |
|
If there are any software or external programs that can decompress compressed files to a specified directory, that would also work.
|
|
| Floor3 yishanju | Posted 2009-03-06 02:28 |
| 银牌会员 Posts 1,357 Credits 1,488 | |
|
Does it mean that all compressed files can only be extracted to one directory?
|
|
| Floor4 yishanju | Posted 2009-03-06 02:33 |
| 银牌会员 Posts 1,357 Credits 1,488 | |
|
WINRAR -- Settings -- Compression -- Default Extraction Path
|
|
| Floor5 lisyofun | Posted 2009-03-06 09:21 |
| 初级用户 Posts 61 Credits 87 | |
|
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.
|
|
| Floor6 yishanju | Posted 2009-03-06 19:31 |
| 银牌会员 Posts 1,357 Credits 1,488 | |
|
-_-_- Then simply make a script to automatically convert RAR.ZIP to self-extracting.
|
|
| Floor7 Hanyeguxing | Posted 2009-03-06 23:34 |
| 银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂 | |
Originally posted by lisyofun at 2009-3-6 09:21: 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 ] |
|
| Floor8 Hanyeguxing | Posted 2009-03-06 23:44 |
| 银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂 | |
|
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 ] |
|
| Floor9 lisyofun | Posted 2009-03-07 12:38 |
| 初级用户 Posts 61 Credits 87 | |
|
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.
|
|
| Floor10 xswdong | Posted 2009-03-08 06:35 |
| 中级用户 Posts 129 Credits 216 | |
|
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. |
|
| Floor11 lisyofun | Posted 2009-03-08 19:12 |
| 初级用户 Posts 61 Credits 87 | |
|
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. |
|
| Floor12 yishanju | Posted 2009-03-11 16:28 |
| 银牌会员 Posts 1,357 Credits 1,488 | |
|
The `rar` command itself supports deleting the source file after decompression
|
|
| Floor13 lisyofun | Posted 2009-03-11 18:56 |
| 初级用户 Posts 61 Credits 87 | |
|
I don't know how to only extract the compressed file that the user clicks on.
|
|
| Floor14 yishanju | Posted 2009-03-12 20:49 |
| 银牌会员 Posts 1,357 Credits 1,488 | |
|
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? |
|
| Floor15 yishanju | Posted 2009-03-12 21:57 |
| 银牌会员 Posts 1,357 Credits 1,488 | |
|
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\
|
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |