Question: I must be doing something differently than what was asked and answered here because the solution does not appear to be working for me: [TeamCity, passing an id generated in one build step to a later build step](https://stackoverflow.com/questions/8219493/teamcity-passing-an-id-generated-in-one-build-step-to-a-later-build-step)

I want use a string generated by one build step in a final build step. So far I have set up an environmental variable called "TEST" that is empty. Both build steps use the Command Line Runner.

Build Step #1:

```
\##teamcity[setParameter name='env.TEST' value='test']

```

Build Step #2:

```
echo $TEST

echo %env.TEST%;

```

Placeholder for now, but if I could access the test string ('test') set in Build Step 1 I would be so happy.

Answer: 
you need to echo that string, e.g.

```
echo "##teamcity[setParameter name='env.TEST' value='test']"

```
It has to be printed to STDOUT, I use `cat` with `heredoc` to avoid having to escape single quotes in the event of using variables to dynamically set config parameters. [What is heredoc?](http://tldp.org/LDP/abs/html/here-docs.html)

```
MYVARNAME=MYVALUE
cat <<EOF
##teamcity[setParameter name='myConfParameter' value='$MYVARNAME']
EOF

```

Result:

```
##teamcity[setParameter name='myConfParameter' value='MYVALUE']

```

[Documentation](https://confluence.jetbrains.com/display/TCD10/Build+Script+Interaction+with+TeamCity)