Author Topic: Trying to a run a program when a torrent finishes but nothing is happening  (Read 243 times)

eternalelir

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
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]
"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]
:: 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]
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

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Trying to a run a program when a torrent finishes but nothing is happening
« Reply #1 on: February 17, 2017, 08:23:54 AM »
Bump. Any help would be appreciated.

KitKat

  • Veteran
  • ***
  • Posts: 344
  • Karma: +26/-0
  • Here i stand with my bayonet...
    • View Profile
Re: Trying to a run a program when a torrent finishes but nothing is happening
« Reply #2 on: February 18, 2017, 10:00:34 AM »
Code: [Select]
"D:\Programs\Scripts\TorrentExtract.bat "%D""

Should be

Code: [Select]
"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 :)
The following BBC is not allowed within your signature: html, img, php.

eternalelir

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Trying to a run a program when a torrent finishes but nothing is happening
« Reply #3 on: February 19, 2017, 10:13:41 AM »
Should be

Code: [Select]
"D:\Programs\Scripts\TorrentExtract.bat" "%D"

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

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Trying to a run a program when a torrent finishes but nothing is happening
« Reply #4 on: February 23, 2017, 02:07:34 PM »
Should be

Code: [Select]
"D:\Programs\Scripts\TorrentExtract.bat" "%D"

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.

I This you miss the (,) try this out

Code: [Select]
"D:\Programs\Scripts\TorrentExtratct.bat", "%D"

eternalelir

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Trying to a run a program when a torrent finishes but nothing is happening
« Reply #5 on: February 24, 2017, 07:05:51 AM »
I This you miss the (,) try this out

Code: [Select]
"D:\Programs\Scripts\TorrentExtratct.bat", "%D"

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.