Re: Executing a command with multiple spaces and parameter using a tSystem component

Hi Roland,

If you need to run on both Windows and Linux, it's very likely that the structure of the commands you'll be using will be (or could later become) very different, and you may find it much more straightforward and easier to maintain with two tSystem components, routing to the correct one using Run If with conditions based on another context variable.

I often use a dummy tJava component for this:

Continuing for now with the current approach, you don't need the first quote, plus you'll need to ensure there is always a space after the contents of EDXMain1, and the easiest way to do this, rather than having to remember each time you change the context variable, is to add this space before the two double quotes you're including between EDXMain1 and EDXMain2.

I tend to find when building strings for things like shell commands, it's useful to build them in e.g. a tMap, and then output the resultant string using a tLogRow, as I can copy this and try running it directly in the shell. Once I'm happy with everything, I then just copy the expression to wherever it's actually needed.

Re: Executing a command with multiple spaces and parameter using a tSystem component

Hi Roland,

I suspect this issue is either down to not fully quoting the individual parameters in the tSystem component, or possibly the way the parameter strings are being formed.

If the parameters are Context variables, then they to do not need to be escaped, but if you're building parameters yourself in code/expressions, then you'll need to escape the slashes (just double them up, so \ becomes \\) in any literal strings you are using, otherwise you could easily end up with carriage returns (\r) or newlines (\n) etc. in your strings.

A quick example using Context variables and just a single tSystem component, where the executable and parameters all have spaces:

As expected, this will open up Notepad++ with the files specified by the two parameters.

Re: Executing a command with multiple spaces and parameter using a tSystem component

Hi Roland,

If you need to run on both Windows and Linux, it's very likely that the structure of the commands you'll be using will be (or could later become) very different, and you may find it much more straightforward and easier to maintain with two tSystem components, routing to the correct one using Run If with conditions based on another context variable.

I often use a dummy tJava component for this:

Continuing for now with the current approach, you don't need the first quote, plus you'll need to ensure there is always a space after the contents of EDXMain1, and the easiest way to do this, rather than having to remember each time you change the context variable, is to add this space before the two double quotes you're including between EDXMain1 and EDXMain2.

I tend to find when building strings for things like shell commands, it's useful to build them in e.g. a tMap, and then output the resultant string using a tLogRow, as I can copy this and try running it directly in the shell. Once I'm happy with everything, I then just copy the expression to wherever it's actually needed.