diff --git a/src/app/application.cpp b/src/app/application.cpp index 67cdd58f3..acd650f5a 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -481,15 +481,23 @@ void Application::runExternalProgram(const BitTorrent::Torrent *torrent) const }); proc.startDetached(); #else // Q_OS_WIN - QStringList args = Utils::String::splitCommand(Preferences::instance()->getAutoRunProgram().trimmed()); + const QString program = Preferences::instance()->getAutoRunProgram().trimmed(); + QStringList args = Utils::String::splitCommand(program); if (args.isEmpty()) return; for (QString &arg : args) + { + // strip redundant quotes + if (arg.startsWith(u'"') && arg.endsWith(u'"')) + arg = arg.mid(1, (arg.size() - 2)); + arg = replaceVariables(arg); + } - LogMsg(logMsg.arg(torrent->name(), args.join(u' '))); + // show intended command in log + LogMsg(logMsg.arg(torrent->name(), replaceVariables(program))); const QString command = args.takeFirst(); QProcess::startDetached(command, args);