Question

I have a script to send a Pushover notification when a torrent finishes downloading through BitTorrent.
The script is:

$parameters = New-Object System.Collections.Specialized.NameValueCollection
$parameters.Add("token", "xxxxxxxxxxxxxxxxxxzbzx")
$parameters.Add("user", "xxxxxxxxxxxxxxxxxxxWJcV")
$parameters.Add("message", "Your torrent has finished dowloading.")

$client = New-Object System.Net.WebClient
$client.UploadValues("https://api.pushover.net/1/messages.json", $parameters)

I want to add the name of the torrent.
On BitTorrent I have this running when a torrent finishes:

powershell.exe -noexit c:\Scripts\transfinish.ps

How can I do this.

Was it helpful?

Solution

The macro %N denotes the title of the torrent. Run the commandline as:

powershell.exe -ExecutionPolicy Unrestricted -File c:\Scripts\transfinish.ps "%N"

You can then access the arguments passed to the script using the $args variable.

For example:

$TorrentName = $args[0]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top