Slashes within quotes, and batch commands such as echo, are handled differently in singleline and multiline Shell/Batch Command
We think the behavior should be changed to never delete the slashes and to always handle non-exe batch commands (as in the multiline case). It looks like the behavior was added to be syntactic sugar that makes single line shell/batch commands handle commands with spaces in them, but so far I haven’t thought of a way to implement that robustly.
We have a workaround (adding comments to make all Shell/Batch Command steps multiline).
With a batch script that takes up a single line:
[list]
Batch commands such as echo or rmdir are not valid (they give an “Unrecognized command” error)
[list]
Slashes within quotes remain untouched[/*:m]
Occurs on Quickbuild version 6.1.16, 2016-05-24, linux server with windows agent.[/*:m]
Linux agent + windows server may be unnecessary; I didn’t test on other configurations.[/*:m][/list:u]
Create a configuration with two variables and two steps:
[list]
Name: clExeSingleSlashes[/*:m]
Variable 2:
[list]
Value: c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe\[/*:m][/list:u][/*:m]
Serial Composition Step [/*:m]
Step 2:
[list]
Build -> Shell/Batch Command step[/*:m]
Single slashes not in quotes are not stripped
[list]
c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe[/*:m][/list:u][/*:m]
07:25:43,108 DEBUG - Executing command: c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe[/*:m][/list:u][/*:m][/list:u]
[/*:m]
Command:
[list]
Output:
[list]
Single slashes in quotes on a command with multiple lines are not stripped
[list]
::multiline[/*:m]
Output:
[list]
::multiline[/*:m]
Single slashes not in quotes, single line
[list]
${vars.getValue('clExeSingleSlashes')}[/*:m][/list:u][/*:m]
Executing Command: c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe[/*:m][/list:u][/*:m][/list:u]
[/*:m]
Command:
[list]
Output:
[list]
Single slashes in quotes, multiline
[list]
:: multiline[/*:m]
Output:
[list]
:: multiline[/*:m]
Single slashes in quotes, multiline (comment making it multiline is the second line rather than the first)
[list]
"${vars.getValue('clExeSingleSlashes')}"[/*:m]
Output:
[list]
"c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe"[/*:m]
Double slashes, in quotes, multiline
[list]
:: multiline[/*:m]
Output:
[list]
:: multiline[/*:m]
Double slashes in quotes, singleline
[list]
"${vars.getValue('clExeDoubleSlashes')}" [/*:m][/list:u][/*:m]
07:15:51,542 DEBUG - Executing Command: "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe\"[/*:m][/list:u][/*:m][/list:u]
[/*:m]
Command:
[list]
Output:
[list]
07:18:37,318 WARN - cl : Command line warning D9024 : unrecognized source file type 'foo', object file assumed[/*:m][/list:u][/*:m][/list:u]
[/*:m]
Command:
[list]
${vars.getValue('clExeSingleSlashes')} foo[/*:m][/list:u][/*:m]
07:20:14,708 DEBUG - Executing Command:[/*:m]
c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe foo[/*:m]
07:20:14,725 WARN - 'c:\Program' is not recognized as an internal or external command,[/*:m]
[*]07:20:14,725 WARN - operable program or batch file.[/*:m][/list:u][/*:m][/list:u][/*:m][/list:u]