Hello :)

I have several hundred RAR archives that I want to extract, but they each have a password which means I can't just select all of them and extract them at the same time, because it will ask me for the password for each archive - this is pretty time consuming and irritating. The password is the same for all of the archives, so is there any way for me to have them all extracted in one go (i.e. by entering the password once and having it apply to all RARs)?

I'm using WinRAR 3.71 with Windows XP Pro SP3.

Thanks!

Dani AI

Generated

A short follow-up that expands on 's batch idea and the replies from , and — extra tips that help when the simple .bat approach fails, plus safer alternatives.

Common problems and quick fixes

  • If the window just flashes and closes (as reported), run the .bat from an open Command Prompt so you can read errors, or add a final line pause to keep the console open.
  • If the extractor is not found, either put UnRAR.exe in the same folder, or use its full path or add its folder to PATH.
  • To prompt once for the password and apply it to every file in the folder, read the password into a variable and loop over the .rar files so you do not hard-code it into the command line. Example (save as a .bat in the folder with your .rar files):
@echo off
set /p PW=Enter password:
for %%F in (*.rar) do "C:\Path\To\UnRAR.exe" x -p%%PW%% "%%F"
pause

Notes on multi-volume sets and behavior

  • If archives are true multi-volume sets (part01, part02, ...), extracting the first part will usually process the rest automatically; if files are independent archives you must handle each separately. (askubuntu.com)

Security and alternatives

  • Both UnRAR and 7-Zip accept a password switch on the command line (UnRAR uses -p; 7-Zip uses -p). See the UnRAR manual and 7-Zip command docs for details. (manpages.org)
  • Beware: passing a secret on the command line exposes it to local process-listing and management tools (Windows exposes a process CommandLine via WMI). Avoid leaving plaintext passwords in scripts on multi-user machines. For stronger secrecy you must use tools that accept passwords via secure input or use an interactive prompt; UnRAR does not provide a safe, built-in stdin password mechanism for scripted, hidden input. (learn.microsoft.com)

Test the approach on a couple of archives first, confirm whether they are multi-part sets or individual archives, and pick the loop-or-first-part strategy that matches what described.

Recommended Answers

All 5 Replies

If the .rar files come in continuous parts for example, file01, file 02, file03, file04, and so on... You can just right click the first file and select "extract here" without having to enter the passwords on by one.

But in your case, it seems that the parts are not continuous. I guess there is no other way than to type/paste in the password on by one.

Yeah, they are all separate files, not parts of one big file, so unfortunately that won't work for me.

I understand that WinRAR can be run from the command line. Does anyone know how to use it in this way? I'm guessing that this would be the way to go, if what I'm asking is even possible. Entering a password 241 times in a row just doesn't sound like fun to me haha.

Cheers.

I figured it out! And here's the solution:

1. Make sure all of the files you want to extract are in the same folder
2. Go to your WinRAR install directory, and copy the "UnRAR.exe" file into the directory containing your archives
3. You need to make a batch file, so open a text editor such as Notepad or Wordpad or whatever you like, and paste the following line into it:

unrar x -p[PASSWORD] *.rar

Replace [PASSWORD] with your desired password (obviously). An example (notice there is no space between the -p and the actual password):

unrar x -pthisismypassword *.rar

Save this file with any name you like, but with a .bat extension (such as "extractor.bat"). This is important! Then, move the file into the same directory as the archives you want to extract (alongside the "UnRAR.exe" file from step 2).

Just double-click the .bat file and your archives will be extracted. Saves a few hours :P

This probably works with zip files, too. Just replace the *.rar with *.zip, or any other supported archive for that matter (*.ace, *.gz, *.tar, etc.)

cant get the solution to work, please help, the batch runs and closes

Thank You So Much ; it works like a charm for me ! i save many boring huors

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.