Jump to content

Run two programs when torrent finishes


Recommended Posts


I've been using bittorrent for a while now and it's working great. After i've downloaded a torrent i've set winrar to automatically extract them. I put this in the run when torrent finishes line:

"C:\Program Files\WinRAR\UnRAR.exe" x -r "%D\*" "%D"

That's working just fine. But I would also like to run another program upon completion. This one:

sendEmail.exe -f x@x.com -t x@x.com -u subject -m %N finished downloading.

How doI make it so bittorrent will run both programs when download finishes?

Thank you.

Link to comment
Share on other sites

  • 4 months later...

The numbers are the order you pass the arguments to the batch file. For example, if you pass %D first, it becomes %1. If you pass %N first, it becomes %1.


Here's an example script I use to make a "copy" of a just completed torrent, using %D (Directory) and %L (Label):

@ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION::------------------------------------------------------------------:::: Create variables based on arguments passed to the batch file,    :::: where the first argument represents the source (downloaded)      :::: torrent files, and the second argument represents the type       :::: of download (e.g., Audio or Video):                              ::::------------------------------------------------------------------::SET source=%~dp1SET target=I:\Led Zeppelin\Torrent Download\%2PAUSE::------------------------------------------------------------------:::: Ensure target directory exists,                                  :::: Build empty target directory structure:                          ::::------------------------------------------------------------------::IF NOT EXIST "%target%"     MKDIR "%target%"XCOPY /t /i "%~1" "%target%\%~nx1"::------------------------------------------------------------------:::: Loop through all files in source directory,                      :::: Manipulate the file path name to reflect target path name,       :::: Invoke FSUTIL to create new hardlinked file names in the         ::::   target directory structure:                                    ::::------------------------------------------------------------------::FOR /F "tokens=* delims=" %%A IN ('DIR /B /S /A:-D "%~1"') DO (    SET output=%%A    SET output=!output:%source%=%target%\!    FSUTIL hardlink create "!output!" "%%~A")EXIT /B:: Example commandline execution::: Bittorrent_Copy.bat  "%D" %L:: Bittorrent_Copy.bat "I:\Torrents\Seeding\1971.08.26  Houston" Video
Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...