Need help with syntax of environment variables


I am having some trouble/confusion with the environment variable syntax for path-like environment variables for both Linux and Windows.  I have been attempting trial-and-error, but without much luck.

For example in Linux, I want to set the path using something like “export PATH=/usr/local/bin;$PATH”.  It should append the existing PATH to the end of my new path string.

Same in Windows, the syntax is “Set PATH = c:\mystuff;%PATH%”

What syntax should I use in TeamCity?  I am having trouble getting things to work.

In addition, how do I handle paths with spaces in them?  Do I need to surround everything with quotes?  I tried this and it does not work, is it single or double quotes?

What if I want to specify a path that includes a TeamCity reference path such as  What syntax do I use to include that path in an environment path variable?  Does the inserted variable include the backslash at the end?

I could not find any good examples of this in the documentation, so some help would be appreciated.

Comment actions Permalink


If you need to set the environment variable in TeamCity Build Configuration settings, you can set "env.Path" environmentvariable (on step 6:Properties and environment variables) to

Usually, you do not need any special care for proparties values that contain spaces.

To add path referencing "lib" directory residing in the build checkout directory to path, add "env.Path" property with value:

For documentation describing the properties handling in TeamCity, please refer to the seciton.

Comment actions Permalink

You answer was very close.  I needed to add the system.file.separator after the  Otherwise I was still getting an error.



Please sign in to leave a comment.