Command Line step + For loops


I've tried everything I can think of to make this work:

We're attempting to setup a Command Line step to wake up some IIS apps on our CI box prior to integration tests, if we use the following in the "Custom Script" we get the error "a was unexpected at this time"

:: Warmup for %%a in (     application_one.localhost     application_two.localhost     application_three.localhost ) do (     curl http://%%a )

this works fine if we create a .bat or .cmd file and execute that, however we'd like to put the body in the custom script section for clarity.

In the docs, it implies that if you want to put "%" into the script then you need to double it up however we want two "%". We've tried using %%%% and that doesn't seem to work.

How can we get %%a into the cmd file that's produced from teamcity!?

Help much appreciated!


1 comment
Comment actions Permalink


With fresh eyes this morning I've realised I was mis-diagnosing the issue. It would appear that

for %%%%a in ( my list ) do( echo %%%%a )

works fine, if not a bit ugly!


Please sign in to leave a comment.