Go Back   TechArena Community > Software > Windows Software
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Winrar command line path extraction

Windows Software


Reply
 
Thread Tools Search this Thread
  #1  
Old 27-02-2009
Member
 
Join Date: Dec 2005
Posts: 81
Winrar command line path extraction
  

Hello everyone,
I created one .bat using winrar command line to convert a file sfx autoexecutable then compresses and then sent by mail using sendemail. But I would like an autoexecutable unpacks in a given file and not in the current directory, and despite my research in the doc, I find nothing. I therefore appeal to you in the hope that one of you knows the solution.

Thank you in advance for your help

__________________
Gunz Dont Kill PEOPLE




I Do........
Reply With Quote
  #2  
Old 27-02-2009
Member
 
Join Date: Oct 2004
Posts: 1,342
Re: Winrar command line path extraction

Follow this steps
1 - make a text file with comments.txt in path = c: \ myaccount \
2 - do your file with your parameters (machin.exe)
3 - winrar to c-zcomment.txt machin.exe
4 - send your mail by machin.exe
Reply With Quote
  #3  
Old 27-02-2009
Member
 
Join Date: Dec 2007
Posts: 1,588
Re: Winrar command line path extraction

WINRAR X [ -switches ] <Archive> [ Files ] [ @File lists ] [ Destination folder\ ]
To extract files, ignoring paths:
WINRAR E [ -switches ] <Archive> [ Files ] [ @File lists ] [ Destination folder\ ]
For example if you wish extract the file LETTER.TXT to the current folder from the archive LETTERS.RAR, use the following command:
WINRAR X LETTERS.RAR LETTER.TXT

Archive extension is optional and may be omitted.
The next command extracts all *.WAV files from the archive Songs to the folder Audio:
WINRAR X Songs *.WAV Audio\
It is also possible to list the files to be extracted in a file, rather than listing them on the command line. In this case the name of the file, containing the list of files to be archived, must be given on the command line. This is indicated by placing the symbol @ before this file name. Thus, if you create a file, Binaries, containing the strings *.exe and *.com, execute the command:

WINRAR X TOOLS @Binaries
all files with EXE and COM extensions from the archive TOOLS will be extracted to the current folder.
During the extraction process, a window containing statistics, will be displayed. If you wish to break the extraction process, click on the Cancel button in the command window. You may press the "Background" button in this window to minimize WinRAR to the tray. If extraction is completed, without problems, WinRAR will terminate, in the case of an error, a Diagnostic message window will be displayed.
Reply With Quote
  #4  
Old 27-02-2009
Member
 
Join Date: Dec 2007
Posts: 1,541
Re: Winrar command line path extraction

Using WinRAR command-line tools
When you install WinRar, two command-line tools are also installed, rar.exe and unrar.exe. They will be located in C:\Program Files\WinRAR by default.

Here's an example of how to extract the contents of a single rar file:
1. open a command prompt
(Windows 2000/xp, choose start->programs->accessories->Command Prompt)

2. add the winrar tools to the path:
c:\> set path="C:\Program Files\WinRAR\";%path%

3. switch to the directory where you want your files to extract to:
c:\> cd /d z:\some_folder

4. use unrar to extract the file:
z:\some_folder> unrar e c:\some_rar_file.rar

You can of course wrap all of this into a batch file that loops through all of the .rar files in a folder. Here's a quicky sample (doesn't handle spaces in .rar file names):
Code:
@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 ------------------
Source: respower.com
Reply With Quote
  #5  
Old 27-02-2009
Member
 
Join Date: Dec 2005
Posts: 81
Re: Winrar command line path extraction

Bravo and thank you
This works perfectly.
__________________
Gunz Dont Kill PEOPLE




I Do........
Reply With Quote
  #6  
Old 03-06-2009
Member
 
Join Date: Jun 2009
Posts: 2
Re: Winrar command line path extraction

Hello everyone,

I have created a batch file to create a winrar sfx archive. What I want to happen is that when the user opens the SFX File, the extraction path is a given directory and not in the current directory. How can i do this using winrar command line?

my command line is:

WinRAR a -r -v4000000 -s -sfx -m5 AUTO

are there any commands to specify the extraction path? thanks!
Reply With Quote
  #7  
Old 03-06-2009
Member
 
Join Date: Jan 2009
Posts: 40
Re: Winrar command line path extraction

Hello Arvin017,

You need unrar.ext to extract files.
startdir is path where you want to start searching *.rar files.
isodir is path where you want files to get extracted.

Code:
@echo off
@CLS
set startdir=F:\RAR
set isodir=F:\ISOs
setlocal enabledelayedexpansion
@ECHO UNRARer v 0.1
@ECHO (c)2009 Supagusti
@ECHO starting in directory: %startdir%                  
FOR /F "delims=;" %%G IN ('"dir "%startdir%\*.RAR" /S /B"') DO unrar e "%%G" *.ISO %isodir%
@ECHO finished!
USE *.AVI or *.MP3 to extract avi or mp3 files instead of .iso
Reply With Quote
  #8  
Old 08-06-2009
Member
 
Join Date: Jun 2009
Posts: 2
Re: Winrar command line path extraction

thanks, it works!!
Reply With Quote
  #9  
Old 27-09-2011
Member
 
Join Date: Sep 2011
Posts: 1
Re: Winrar command line path extraction

This script works great but how can I add it to automatically overwrite folders and files? I am overwriting every hour and running it in a batch, I don't feel like hitting Yes on every file to overwrite.

Thanks
Jeff
Reply With Quote
Reply

  TechArena Community > Software > Windows Software
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Winrar command line path extraction"
Thread Thread Starter Forum Replies Last Post
WinRAR command line to unzip files in multiple directories jymoo Software Development 1 05-10-2011 12:37 PM
command line parameters for creating a self extracting exe with WinRAR kat_2403 Windows Software 1 24-08-2011 12:35 PM
xcopy command line together with wmplayer command line Aislinn Operating Systems 5 31-03-2010 12:13 PM
Winrar: Create SFX via Command Line magicT Windows Software 3 03-07-2009 01:26 PM


All times are GMT +5.5. The time now is 02:20 AM.