Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将torrent名称添加到PowerShell脚本,该脚本在下载完成后运行_Powershell_Bittorrent - Fatal编程技术网

将torrent名称添加到PowerShell脚本,该脚本在下载完成后运行

将torrent名称添加到PowerShell脚本,该脚本在下载完成后运行,powershell,bittorrent,Powershell,Bittorrent,我有一个脚本,可以在torrent通过BitTorrent完成下载时发送Pushover通知。 剧本是: $parameters = New-Object System.Collections.Specialized.NameValueCollection $parameters.Add("token", "xxxxxxxxxxxxxxxxxxzbzx") $parameters.Add("user", "xxxxxxxxxxxxxxxxxxxWJcV") $parameters.Add("me

我有一个脚本,可以在torrent通过BitTorrent完成下载时发送Pushover通知。 剧本是:

$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)
我想添加torrent的名称。 在BitTorrent上,我在torrent完成时运行此命令:

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

如何执行此操作。

宏%N表示torrent的标题。以以下方式运行命令行:

powershell.exe -ExecutionPolicy Unrestricted -File c:\Scripts\transfinish.ps "%N"
然后可以使用$args变量访问传递给脚本的参数

例如:

$TorrentName = $args[0]

你正在运行什么程序来下载你的torrents?不。它给出了某种错误,然后终止了命令行。第5行应该是:$parameters.Addmessage,你的torrent$$arg[0]已经完成下载。我的错误是,$args[0]不是$arg[0],我已经更新了答案