![]() |
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-10 11:01 |
47,811 topics / 349,897 posts / today 0 new / 48,255 members |
| DOS批处理 & 脚本技术(批处理室) » [Help] Call the WinRAR program directly from a batch file |
| Printable Version 1,309 / 14 |
| Floor1 kongzi | Posted 2008-11-16 14:06 |
| 新手上路 Posts 9 Credits 9 | |
|
How can I use a batch file to directly call the system's WinRAR program, no matter which drive the compression program is installed on?!!!
|
|
| Floor2 balinger | Posted 2008-11-16 14:36 |
| 中级用户 Posts 115 Credits 356 | |
| Floor3 kongzi | Posted 2008-11-16 15:22 |
| 新手上路 Posts 9 Credits 9 | |
|
Many thanks to balinger, but I tried running it, and why does it exit after pressing any key to continue? It didn't run the WinRAR program!
|
|
| Floor4 tireless | Posted 2008-11-16 15:41 |
| 银牌会员 Posts 1,122 Credits 2,025 | |
|
That damn BUG in reg.exe... if I use reg query directly it drops characters, so there's no choice but to export first. [ Last edited by tireless on 2008-11-16 at 17:38 ] |
|
| Floor5 kongzi | Posted 2008-11-16 15:46 |
| 新手上路 Posts 9 Credits 9 | |
|
What I want is to write a batch file to traverse the system's rar archives and call the WinRAR command line to delete a certain file inside the rar archives. How should this batch file be written? Thanks!!! winrar d deletes files inside an archive.
[ Last edited by kongzi on 2008-11-16 at 15:48 ] |
|
| Floor6 tireless | Posted 2008-11-16 15:49 |
| 银牌会员 Posts 1,122 Credits 2,025 | |
|
The code in post #4 has been updated.
[ Last edited by tireless on 2008-11-16 at 15:54 ] |
|
| Floor7 kongzi | Posted 2008-11-16 16:00 |
| 新手上路 Posts 9 Credits 9 | |
|
I tried running it and got an error. :(
|
|
| Floor8 tireless | Posted 2008-11-16 16:01 |
| 银牌会员 Posts 1,122 Credits 2,025 | |
|
What is the error message?
|
|
| Floor9 kongzi | Posted 2008-11-16 16:02 |
| 新手上路 Posts 9 Credits 9 | |
|
Let me explain it more clearly. I want to write a batch file to traverse the system's rar archives, and if an archive contains 1.exe, call the WinRAR command line to delete the program 1.exe from that rar archive. How should this batch file be written? Thanks!!! winrar d deletes files inside an archive.
|
|
| Floor10 kongzi | Posted 2008-11-16 16:05 |
| 新手上路 Posts 9 Credits 9 | |
Originally posted by tireless at 2008-11-16 04:01 PM: --------------------------- C:\Program --------------------------- Windows cannot find the file 'C:\Program'. Please make sure the filename is correct, and then try again. To search for a file, click the "Start" button, and then click "Search". --------------------------- OK --------------------------- |
|
| Floor11 kongzi | Posted 2008-11-16 16:07 |
| 新手上路 Posts 9 Credits 9 | |
|
for /d %%i in (C,D,E,F,G,H,I,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z\*.rar) do (
IF exist %%i: ( winrar.exe d %%c\*.rar 1.exe ) ) This is what I wrote, definitely not correct. This only traverses archive files under the root directories of the drives. |
|
| Floor12 tireless | Posted 2008-11-16 16:09 |
| 银牌会员 Posts 1,122 Credits 2,025 | |
Originally posted by kongzi at 2008-11-16 04:05 PM: Sorry, I got one part wrong. Try the code in post #4 again. |
|
| Floor13 kongzi | Posted 2008-11-16 16:24 |
| 新手上路 Posts 9 Credits 9 | |
|
Many thanks to tireless, the program can run now, but it doesn't seem to have achieved the effect I expected.
|
|
| Floor14 kongzi | Posted 2008-11-16 16:41 |
| 新手上路 Posts 9 Credits 9 | |
| Floor15 tireless | Posted 2008-11-16 17:13 |
| 银牌会员 Posts 1,122 Credits 2,025 | |
|
This only searches for .rar files under the root directories of the drives:
If you want to search for .rar files including subdirectories, change: for %%a in (%%A:\*.rar) to: for /r %%A: %%a in (*.rar) [ Last edited by tireless on 2008-11-16 at 17:35 ] |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |