Run script with parameters: error in log

I’m experiencing a minor issue with the run-script-before-required and run-script-after options. I’m trying to run an application and pass some parameters to the application. The path to the executable contains spaces, and some of the parameters start with “–”, which appears to require quoting. I have not been able to get it to work in any other way that quoting both the path and the parameters. I’m using the GUI to add this. Something like this works:

"D:\Path to executable\application.exe" "--start" "ServiceName"

However, it also throws a warning like this, even though the application gets called:

[Warning-Duplicati.Library.Main.Controller-OptionValidationError]: The value ""D:" supplied to --run-script-before-required does not represent a valid path

I’ve taken this approach from Arguments for scripts before/after options · Issue #2926 · duplicati/duplicati · GitHub. I also found this duplicati/Duplicati/Library/Modules/Builtin/run-script-example.sh at master · duplicati/duplicati · GitHub, which refers to a --run-script-with-arguments flag, but I can’t seem to find it in the GUI and the aforementioned issue thread doesn’t mention it either. Should I be using it?

This seems to be similar: OptionValidationError in logs. But there the quotes were not required (no spaces in path, no arguments).

Now I am aware that I can almost certainly get it to work by wrapping the command with parameters into a single batch file (haven’t tried it yet), but it feels like this shouldn’t be necessary.

Any help is appreciated!

Edit: I’ve done some further testing:

  • Using a batch file that calls my script to avoid the need for parameters, I get the same error if I quote the path (it contains spaces). If I remove the quotes, it works without error. This seems to suggest that the quotes surrounding the path are the problem, and is consistent with the thread quoted above.
  • Any combinations I’ve tried using either a quoted path to the executable or an unquoted path to the executable, and either quoted or unquoted parameters, either result in “the system cannot find the file specified” or a large negative exit code (-532462766) that I don’t believe is caused by the called program.
  • Also when I move the application to a directory without spaces I cannot get it to work.

Conclusion: I’m either missing something obvious, or the validation method that checks if the argument represents a valid path fails because of the way that I provide arguments (perhaps the presence of quotes in the argument value fails because these are not valid path characters?).

Only if you are running a version that has it, which at the moment means Canary test release.

doesn’t say very much, but you found the relevant GitHub issue and pull request. Check dates.

2.0.9.108 Canary view:

C:\Duplicati\duplicati-2.0.9.108_canary_2024-10-03-win-x64-gui>Duplicati.CommandLine help run-script-with-arguments
  --run-script-with-arguments (Boolean): Enable script arguments
    This option enables the use of script arguments. If this option is set, the script arguments are treated as commandline strings. Use single or double quotes to separate arguments.

and I think it’s unusual that a boolean comes up like that. You may need to uncheck and check.

Aaaaaaah… Thank you for your answer! I cannot believe that I overlooked that this is only available in the Canary releases, which I indeed am not using.

I guess that answers my question: I should either switch to Canary or use my batch-file workaround until a new beta is available that supports this.