this post was submitted on 10 Sep 2023
57 points (91.3% liked)

Asklemmy

43874 readers
1408 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy ๐Ÿ”

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_[email protected]~

founded 5 years ago
MODERATORS
 

I use winrar.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 59 points 1 year ago* (last edited 1 year ago)

This can be easily done using PowerShell, and rar.exe which is part of WinRAR. Just edit the first three variables below according to your needs and run the script. You don't even need to save it as a script, just copy-paste the code into a PowerShell window, you can use the arrow keys to edit the variables (or edit it using notepad if you like) and then press enter when you're ready to run the script.

$winrar = "C:\Program Files\WinRAR\Rar.exe"
$passlist = @("pass1", "pass2", "pass3", "pass4")
$folder = "C:\Path\To\Folder"

cd "$folder"
foreach($file in (dir *.rar).Name) { "Checking $file..."; foreach($pass in $passlist) { .$winrar t -p"$pass" "$file" *>$null ; if($LASTEXITCODE -eq 0){ " โ†’ Password for $file is $pass"; break }}""}

This would give you an output which looks like:

Checking file1.rar...
 โ†’ Password for file1.rar is pass1

Checking file2.rar...
 โ†’ Password for file2.rar is pass2

Checking file3.rar...
 โ†’ Password for file3.rar is pass3

If there's something you don't understand in the code above, lemme know - happy to explain further. :)