Page 1 of 2
Script to "Extract here..." in WinRAR
Posted: 16 Apr 2008 17:16
by ivan
I would be very grateful if someone is able to write a XYScript for me to extract file(s) from RAR archive(s) that I select. Ideally things will go like this:
1. Select file(s) to unrar.
2. Press a button (a hot key that would be associated with a script)
3. Open a beer
For those who are familiar with Windows Command Scripts here's an example of how it would look in a batch script:
Code: Select all
@REM ------- BEGIN demo.cmd ----------------
@setlocal
@echo off
set path="C:\Program Files\WinRAR\";%path%
for /F %%i in ('dir /s/b *.rar') do call :do_extract "%%i"
goto :eof
:do_extract
echo %1
mkdir %~1.extracted
pushd %~1.extracted
unrar e %1
popd
REM ------- END demo.cmd ------------------
I hope it helps to make situation clearer and to create a script

Posted: 16 Apr 2008 17:55
by eurytos
you could set the default action in winrar to 'extract here' and then select the files and double click. Unless I am missing something I don't really see a need for a script?
I don't remember the exact terminology they use for 'extract here' in the application since I do not use it anymore but it is something along those lines.
Posted: 16 Apr 2008 18:10
by jacky
You don't need script, just a UDC "Open With" with this as Application (on Multiple instance) :
Optionally, you can use this instead to "Extract Each to Subfolder" :
Posted: 16 Apr 2008 18:29
by TheQwerty
jacky wrote:You don't need script, just a UDC "Open With" with this as Application (on Multiple instance) :
Optionally, you can use this instead to "Extract Each to Subfolder" :
To be on the safe side you might want to add "--" before <items> in either of those.
That signifies the end of the switches list and will prevent WinRAR from attempting to parse an item starting with "-" as a switch.
Posted: 16 Apr 2008 18:36
by ivan
I know it's possible to extract with a couple of clicks, but I prefer a one finger (pressing a button) solution
Also, most of the time not every single file in the dir is a RAR file. So just opening isn't enough, it needs to extract in the same dir as the selected file...
Posted: 16 Apr 2008 18:43
by bergfex
ivan wrote:I know it's possible to extract with a couple of clicks, but I prefer a one finger (pressing a button) solution

Just assign a KS to the UDC.
Posted: 16 Apr 2008 18:48
by jacky
TheQwerty wrote:To be on the safe side you might want to add "--" before <items> in either of those.
Right, good one, thanks
And yeah, as bergfex said just assign a KS and it will only take one key. And once CTB will be there, you will even be able to create you own TB button to do the same, so you'll be able to have it in one click also!
Posted: 17 Apr 2008 10:54
by ivan
The Open With UDC isn't effective for the purpose because it just opens, it doesn't extract as necessary

Posted: 17 Apr 2008 11:41
by jacky
ivan wrote:The Open With UDC isn't effective for the purpose because it just opens, it doesn't extract as necessary

Yes, it does. If you specify a command line with action x (for extract) as showed in the examples above, it will extract the selected archives and not open it. I should know, whenever I need to extract an archive I only press one key (KS for such UDC) !
Posted: 17 Apr 2008 11:57
by ivan
Well, it doesn't work for me. Perhaps I'm doing something wrong and just don't see it. Any chance of a step-by-step? Thanks in advance

Posted: 17 Apr 2008 15:19
by eurytos
If winrar is not in your path you may have to use:
"c:\Program Files\winrar\winrar.exe"
instead of:
"WinRAR"
The path could be different depending on where you installed it.
Posted: 17 Apr 2008 15:23
by ivan
nope, doesn't work. still just opens the RAR and doesn't extract here.
Posted: 17 Apr 2008 15:35
by admin
ivan wrote:nope, doesn't work. still just opens the RAR and doesn't extract here.
Works fine here (WinRAR 3.0). Maybe you check your WinRAR version/manual on commandline parameters...
Posted: 17 Apr 2008 16:17
by ivan
Here's the view of UDC, what am I doing wrong? WinRAR 3.71 is intalled.

Posted: 17 Apr 2008 16:31
by j_c_hallgren
Shouldn't the "x <items>" be on the Application line and not the Caption? Since the Caption is just for display...right???