Splitting Command Lines

Top  Previous  Next

 

In some cases, particularly when calling external professional applications from a Pipeline Runner script or project, the command lines can get very long indeed. Whilst Pipeline Runner can easily handle such long command lines, people are not so lucky and having very long lines of text can make it very difficult for the user to read and edit those parts of scripts.

 

In order to make life easier for Pipeline Runner users, a special syntax is provided to allow you to split the lines however you like, to any depth. To do this, simply start the first line with an @ sign and end the last line with a semicolon.

 

Syntax

 

@[Split Line Command];

 

Both Split Command Tokens (the @ sign before the command and the semicolon after it) are compulsory. Any text in between the start and end tokens will be concatenated into a single command so any additional spaces or characters you enter will be included in the final command line. Similarly if you do not include any spaces at the split point then two words may become joined and that could potentially cause an error to be thrown if the command is not expecting that. The key thing to understand is that whatever you put inside the split command text lines will be replicated in the final output.

lamp Important: You must ensure that you position the tokens correctly. If you do not include the starting @ sign, each split line will be treated as an individual command. If you do not include  the closing semi-colon, subsequent commands will be concatenated as well. In both cases this can be pretty much guaranteed to lead to fatal errors being reported.

Handling Command Lines Containing Semicolons

 

If you have a command line which contains multiple path and file name pairs separated by semicolons, you may well wish to split the lines by file but leaving the semicolon at the end of the line would result in an error, and if you move it to the next line it would be treated as a comment leading to a different error. To resolve this problem you need to escape the semicolon by adding another semicolon to each split inside the command line that ends with a semicolon, and finish with a single semicolon at the end of the command line so that this:

 

Exec:"%%ExternalApp%%", ""%%ApplicationRoot%%\bin\Release\Lib1.dll;%%ApplicationRoot%%\bin\Release\Lib2.dll;%%ApplicationRoot%%\bin\Release\Lib3.dll""

 

becomes this:

 

@Exec:"%%ExternalApp%%",

""%%ApplicationRoot%%\bin\Release\Lib1.dll;;

%%ApplicationRoot%%\bin\Release\Lib2.dll;;

%%ApplicationRoot%%\bin\Release\Lib3.dll"";

lamp Note: Splitting command lines is a 'manual only' process. There is no automatic option in Pipeline Runner Studio because the number of ways a complex command line can be split is pretty much unlimited. As a result if you want to use Split Command Lines you have to physically modify the script yourself.

Example:

 

The following example is somewhat contrived as the commands are comparatively short and this feature would normally be used with very long commands. However it clearly demonstrates splitting two types of command - a Var command and a Remark command - as well as a Script Section Heading:

 

[Setup]

Var:GenerateReport,true

@Var:ReportFileName,

"C:\Programming\Test\Test Report.txt"; // Resulting command: Var:ReportFileName,"C:\Programming\Test\Test Report.txt"

 

@[Split

Remark

Section

Heading]; // Resulting command: [Split Remark Section Heading]

@Remark:This is the first part of the Remark

and this is the second part

of the Remark|BlankLineBeforeAndAfter; // Resulting command: Remark:This is the first part of the Remark and this is the second part of the Remark|BlankLineBeforeAndAfter

 

See Also: Escaped Strings Logical Operators Reserved Characters Reserved Strings