Results 1 to 9 of 9

Thread: Winrar command line path extraction

  1. #1
    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........

  2. #2
    Join Date
    Oct 2004
    Posts
    1,343

    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

  3. #3
    Join Date
    Dec 2007
    Posts
    1,602

    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.

  4. #4
    Join Date
    Dec 2007
    Posts
    1,548

    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

  5. #5
    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........

  6. #6
    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!

  7. #7
    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

  8. #8
    Join Date
    Jun 2009
    Posts
    2

    Re: Winrar command line path extraction

    thanks, it works!!

  9. #9
    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

Similar Threads

  1. WinRAR command line to unzip files in multiple directories
    By jymoo in forum Software Development
    Replies: 1
    Last Post: 05-10-2011, 12:37 PM
  2. Replies: 1
    Last Post: 24-08-2011, 12:35 PM
  3. xcopy command line together with wmplayer command line
    By Aislinn in forum Operating Systems
    Replies: 5
    Last Post: 31-03-2010, 12:13 PM
  4. Winrar: Create SFX via Command Line
    By magicT in forum Windows Software
    Replies: 3
    Last Post: 03-07-2009, 01:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •