1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: WinRar Command Line Question

Discussion in 'All Other Software' started by Reconsniper1, Apr 17, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. Reconsniper1

    Reconsniper1 Thread Starter

    Joined:
    Apr 16, 2008
    Messages:
    15
    Hello Everyone!
    I'm a first time poster! My current project is making a batch file that will compress a folder / drive, password protect it. I then I will include my Nero batch info and burn it to DVD so that it is password protected. I'm having issues with the Winrar batch part. I have it listed below


    "C:\Program Files\WinRAR\rar.exe" a -m5 -e -pTest c:\test\ c:\

    However it doesn't copy anything. Can someone please help me out if my flags are incorrect or syntax is incorrect.

    Thanks in advanced,
    T
     
  2. TheOutcaste

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    Welcome to TSG!
    "C:\Program Files\WinRAR\rar.exe" a -m5 -e -pTest c:\test\ c:\

    -e Invalid switch. I'm guessing you want -ed to not archive empty folders
    c:\test\ This tells WinRar to create an archive named c:\test\.rar, which is an invalid name. This should be just C:\test or better yet c:\test.rar
    c:\ Do you really want to put the entire C: drive into the archive? This will include the page file and hibernation file if it exists, and could take several hours. If your drive is more than 50% full, it could crash before it finishes, as it may run out of disk space.

    The following will create an archive named test.rar in the root of the C drive which will contain the contents of the folder C:\test and all subfolders except empty ones.

    "C:\Program Files\WinRAR\rar.exe" a -m5 -ed -pTest c:\test.rar c:\test

    If you need to specify a particular type of file AND include subfolders, you have to use the -r switch:
    "C:\Program Files\WinRAR\rar.exe" a -m5 -ed -pTest c:\test.rar c:\test\*.doc
    will back up *.doc files in the Test folder only
    "C:\Program Files\WinRAR\rar.exe" a -m5 -ed -pTest -r c:\test.rar c:\test\*.doc
    will back up *.doc files in the Test folder and subfolders.

    HTH

    Jerry
     
  3. TheOutcaste

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    An additional thought, It would be a good idea to add a recovery record. This will allow you to repair the archive in case there is an error during the burn, or later on trying to read the file. A 1% recovery record will allow you to recover the archive even if a section up to 0.6% of the archive size is damaged.
    See the -rr switch in the help file.

    Jerry
     
  4. Reconsniper1

    Reconsniper1 Thread Starter

    Joined:
    Apr 16, 2008
    Messages:
    15
    Hello all and thanks for your replies. I wasn't trying to imply that I was backing up the complete C: drive. That would be insane. I actually had the syntax incorrect. I have corrected it and used the following batch file. It works so i'm happy with that.

    "C:\Program Files\WinRAR\rar.exe" a -m5 -ed -r -rr -x*.jpg -pTest "c:\Backup

    %date:~10,4%_%date:~4,2%_%date:~7,2%.rar" Z:\
    Pause

    I have this section of my batch file complete. Now I need to get a few other piece fixed and it will be complete.

    I will find the correct place for DOS batch questions. :) Thanks again. :)
     
  5. TheOutcaste

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    You're Welcome!
    Dos forum is here: http://forums.techguy.org/23-dos-pda-other/

    If your issue has been resolved you (and ONLY you) can use the Thread Tools at the Upper Right (above the first post) to mark this thread Solved.:)
    [​IMG]
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/704527

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice