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?).