Oddity with ScriptCommandData.cmdline

If I have a script command called test and I execute as follows and display the ScriptCommandData.cmdline using DOpus.output:

test a s d f = test a s d f
test /profile = test /profile
test {apppath|winword.exe}\winword.exe = test "C:\Program Files\Microsoft Office\Root\Office16\\winword.exe"

(1) and (2) both behave as expected. (2) demonstrates that a normal alias is not resolved whereas (3) resolves and adds surrounding quotes and slips in a second backslash immediately before winword.exe.

That's just how it works internally. {} codes are parsed by the command interpreter before running each command (otherwise each command, including yours, would have to parse them). /aliases aren't parsed, but instead are passed to individual commands as is.

The quotes are part of the parsing system (use @nofilenamequoting to disable them). The extra backslash is there because you added it.

Thanks for the explanation @Jon.

It appears that the command interpreter resolution includes a trailing path backslash when processing apppaths whereas DOpus.FSUtil.resolve("{apppath|winword.exe}") doesn't. That's what made me think an extra backslash had been introduced.

Out of interest I tried the same thing with test %appdata% and in this case the command interpreter resolution does not include a trailing path backslash.

test %appdata% = test C:\Users\Me\AppData\Roaming

Anyway, now that I know about the command interpreter behaviour I know what to expect.

%appdata% will insert whatever is in the environment-variable, which may not even be a path, as-is.

Of course! :blush: