Trying to a run a program when a torrent finishes but nothing is happening

Windows specific questions, problems.
Post Reply
eternalelir

Trying to a run a program when a torrent finishes but nothing is happening

Post by eternalelir »

Hello all,

I just spent the last 30 min reviewing the top 20 search results for "running programs after a torrent finishes" and none of the solutions seemed to do anything. Multiple threads suggests that my setup is fine so I'm hoping someone can chime in.

In qBit options I have the following for "Run external program on torrent completion"

Code: Select all

"D:\Programs\Scripts\TorrentExtract.bat "%D""
I've tried the following as well:
  • D:\Programs\Scripts\TorrentExtract.bat "%D"
  • "D:\Programs\Scripts\TorrentExtract.bat" "%D"
  • "D:\Programs\Scripts\TorrentExtract.bat \"%D\""
  • "D:\Programs\Scripts\TorrentExtract.bat \"%D\""
  • cmd.exe /C "D:\Programs\Scripts\TorrentExtract.bat" "%D"
My script:

Code: Select all

:: This program will extract a .rar or .zip file
::
:: Author: Scott Walters
::

@echo on

pushd "C:\Program Files\7-Zip\"

::take argument and assign variable
set torrentPath=%1

:: Checks for .rar or .zip file
if exist %torrentPath%\*.rar GOTO RAR
if exist %torrentPath%\*.zip GOTO ZIP


:: Runs if the directory contains a .rar file
:RAR

7z x -o%torrentPath% %torrentPath%\*.rar
GOTO END


:: Runs if the directory contains a .zip file
:ZIP

7z x -o%torrentPath% %torrentPath%\*.zip
GOTO END


:: Runs at the end of the sequence
:END

:: Comment out pause if you want the cmd window to close when done.
pause
When a torrent finishes, there's no indication whatsoever that script even attempted to run. This script had been working fine for years using uTorrent so I know that's not the issue. In uTorrent is just used the following in their box labelled "Run this program when a torrent finishes:"

Code: Select all

D:\Programs\Scripts\TorrentExtract.bat "%D"

Any help would be greatly appreciated. I just reinstalled Windows and decided to try qBit out instead of dealing with the hassle of yanking out the ads for uTorrent. If I can't get this sorted, I'm going to have to reluctantly go back...  :-\

  • Windows 10
  • qBit 3.3.10
  • Qt 5.7.1
  • Libtorrent 1.0.10.0
  • Boost 1.62.0
  • Testing on torrents with a video split into multiple .rar chunks
  • Fresh install of qBit
eternalelir

Re: Trying to a run a program when a torrent finishes but nothing is happening

Post by eternalelir »

Bump. Any help would be appreciated.
KitKat

Re: Trying to a run a program when a torrent finishes but nothing is happening

Post by KitKat »

[quote="eternalelir"]

Code: Select all

"D:\Programs\Scripts\TorrentExtract.bat "%D""
[/quote]

Should be

Code: Select all

"D:\Programs\Scripts\TorrentExtract.bat" "%D"
You forgot to enclose the first parameter/had incorrect enclosures.

Program would read what you had as
arg 1: "D:\Programs\Scripts\TorrentExtract.bat " lingering space at the end, and encapsulated
arg 2: %D    < non-encapsulated so any spaces in this part will cause a break.
arg 3: ""      < encapsulated nothingness?

Try that and report back if issues :)
eternalelir

Re: Trying to a run a program when a torrent finishes but nothing is happening

Post by eternalelir »

[quote="KitKat"]
Should be

Code: Select all

"D:\Programs\Scripts\TorrentExtract.bat" "%D"
[/quote]

Thanks for the reply. I tried that as one of my permutations and still had no response from qbittorrent when a torrent finished. Tried it again just to be sure and no luck. I installed utorrent and tested it there without problems so it seems like either a syntax issue or qbit just isn't running the script.
kotua

Re: Trying to a run a program when a torrent finishes but nothing is happening

Post by kotua »

[quote="eternalelir"]
[quote="KitKat"]
Should be

Code: Select all

"D:\Programs\Scripts\TorrentExtract.bat" "%D"
[/quote]

Thanks for the reply. I tried that as one of my permutations and still had no response from qbittorrent when a torrent finished. Tried it again just to be sure and no luck. I installed utorrent and tested it there without problems so it seems like either a syntax issue or qbit just isn't running the script.
[/quote]

I This you miss the (,) try this out

Code: Select all

"D:\Programs\Scripts\TorrentExtratct.bat", "%D"
eternalelir

Re: Trying to a run a program when a torrent finishes but nothing is happening

Post by eternalelir »

[quote="kotua"]
I This you miss the (,) try this out

Code: Select all

"D:\Programs\Scripts\TorrentExtratct.bat", "%D"
[/quote]

Nope. Adding a comma should break syntax, but I tried it anyway and saw no change. I even tried specifying cmd.exe and passing it a path to the .bat file which works when calling it from the run prompt. Still no luck. After some searching on the forums, I found a thread last updated in June 2016 which basically says running cmd or bat from that field isn't working on ver 3.5 or later. They ended up downgrading to 3.4 to get it to work. If I have to jump through that many hoops I'm just going to go back to uTorrent. Qbit has a lot to like, but it still needs a bit more polish apparently.
Post Reply