Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: batch file to unrar one file from more archives to different folders  (Read 14913 times)

0 Members and 1 Guest are viewing this topic.

yavvie

    Topic Starter


    Rookie

    Re: batch file to unrar one file from more archives to different folders
    « Reply #15 on: March 25, 2008, 07:41:53 AM »
    OK, now i got it working all the way to the unrar-ing... how can i add unrar.exe to the batch file? I installed unrar.exe (from winrar page) to program files, but i probably still need to add it to some library, or? ???

    yavvie

      Topic Starter


      Rookie

      Re: batch file to unrar one file from more archives to different folders
      « Reply #16 on: March 25, 2008, 07:49:45 AM »
      woohoo got it working :)
      thanx for the help.

      the script looks like this:

      Code: [Select]
      for /F "delims=." %%R in ('dir /b U:\Archive_200803*.rar') do (
         MD "C:\test\%%~nR"
         unrar x "U:\%%R" FolderB\File.bak
         move FolderB\File.bak "C:\test\%%~nR"
         rd FolderB
         )

      and i had to add the unrar.exe path to MyComputer settings :) (My Computer -> properties -> Advanced -> Environment Variables -> System variables / Path)

      garp99

      • Guest
      Re: batch file to unrar one file from more archives to different folders
      « Reply #17 on: October 07, 2008, 11:46:25 PM »
      Code: [Select]
      :: MD "C:\test\%%~nR"
      for /F "delims=." %%R in ('dir /b U:\Archive_200803*.rar') do unrar e "U:\%%R" FolderB\File.bak "C:\test\%%~nR"
      1st post  :)

      Since I just finished getting a batch script working to unrar password-encrypted RAR files,
      I knew there was an easier way... even if this thread is old, it could help others.

      The make directory MD is not necessary since original poster said it would exist.
      As well, the previous code example was creating and destroying directories each time for each archive
      that it found... makes everything slow and was not necessary... only needed before and after for loop.

      For my example, you can extract the file directly without the tree structure by using "unrar e" instead
      of "unrar x", and you can also specify the output directory as the last parameter.

      Enjoy!   :D