3

After a torrent download on qbittorrent completes, I am executing an external program via the options menu:

Tools -> Options -> Downloads --> Run external program on torrent completion

"C:\Program Files\WinRAR\AutoUnRAR.bat" "%F\*.rar" "E:\Downloads\"

In the file I have created named AutoUnRAR.bat lies the code:

@ECHO off
timeout /t 10 /nobreak
set arg1=%1
set arg2=%2
shift
shift
START "" "C:\Program Files\WinRAR\WinRAR.exe" x "%arg1%" "%arg2"

A timeout is required, because when I was calling this directly from qbittorrent with the execution:

 "C:\Program Files\WinRAR\WinRAR.exe" x "%F\*.rar" "E:\Downloads\"   

the file is labeled as still being in use (the WinRAR command -dh doesn't work), and WinRAR gives the error "The process cannot access the file because it is being used by another process."

Once the download has finished, and the 10 second countdown ends, WinRAR gives the error

fileDIRECTORY\file.rar: No files to extract

Upon inspection of the folder, the files are indeed there and can be manually extracted, it is for some reason not extracting the .rar file. In this case there happens to be many parts, .r00 .r01 ... and a file with just .rar. I am only targeting the .rar file but WinRAR has no problem when you extract any of the parts singly.

2
  • "%arg2" should be "%arg2%"
    – DavidPostill
    Apr 5, 2016 at 8:45
  • No problem. I've added a proper answer, which you can accept.
    – DavidPostill
    Apr 5, 2016 at 20:34

2 Answers 2

0

WinRAR gives the error "fileDIRECTORY\file.rar: No files to extract"

START "" "C:\Program Files\WinRAR\WinRAR.exe" x "%arg1%" "%arg2"

There is an error in the above command, "%arg2" should be "%arg2% (missing %).

So the command should be:

START "" "C:\Program Files\WinRAR\WinRAR.exe" x "%arg1%" "%arg2%"
0

You don't need to use a .bat for the timeout. You can use this in the Run external program... field of qBittorent.

cmd /c timeout /t 15 & "C:\Program Files\WinRAR\UnRAR.exe" x "%F\*.rar" "%F"

Note: If you need to test a command for this, you can try it in the "run" box on windows.

Note2: You could probably use WinRAR.exe still. UnRAR just keeps everything in the background.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .