I use winrar.

  • d3Xt3r@lemmy.nz
    link
    fedilink
    arrow-up
    31
    ·
    1 year ago

    This can be easily done using the rar.exe program which comes part of WinRAR, and PowerShell. Edit the first three variables according to your needs and run the script. You don’t even need to save it as a script, just copy-paste it into a PowerShell window, you can just use arrow keys to edit the variables 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, lemma know - happy to explain further. :)