TeamCity 4.0.1 - expanding %TEMP% directory

We use .cmd files a lot.  One of the common entries in a .cmd file look like this: set TEMP_LOG=%TEMP%\MyCoolLog.log

Setup #1: In (TeamCity Professional Version 3.1.2 (build 6881)), %TEMP% is expanded by TeamCity into C:\TeamCity\buildAgent\temp\buildTmp
Setup #2: In (TeamCity Enterprise Version 3.1.2 (build 6881)),  %TEMP% is expanded by TeamCity into C:\TeamCity\buildAgent\temp\buildTmp
Setup #3: In (TeamCity Enterprise Version 4.0.1 (build 8171)),  %TEMP% is expanded by TeamCity into C:\Documents and Settings\SomeUser\Local Settings\Temp

where "SomeUser" is the network process ID that "TeamCity Build Agent Service" and "TeamCity Web Server" runs under.

In all 3 cases the same account is being used for "TeamCity Build Agent Service" and "TeamCity Web Server".

The issue is when %TEMP% is expanded into C:\Documents and Settings\ it screws up further processing due to spaces in the path.
One might say: [So what? Make sure the path is enclosed in double quotes and move on! Something like this: set TEMP_LOG="%TEMP%\MyCoolLog.log"].
This will work and may be a better way to handle %TEMP%, however, we have hundreds upon hundreds of files that do not enclose in double quotes and things work fine in TC Professional or TC Enterprise 3.1.2.

Why is this an issue in TC Enterprise 4.0.1?  Is it something I did or didn't do during setup?  Can I change that behavior by tweaking some config file so %TEMP% is expanded into C:\TeamCity\buildAgent\temp\buildTmp like in previous versions of TC?
I have a feeling that this is configurable, and I just can't find where...

Please advise.

Comment actions Permalink


Seems, you've found a bug: command line runner does not redefine TEMP environment variable, while it should. I filed the bug into our tracker.

To force TEMP variable into your build you can add the following line into conf/ file of your TeamCity agents:

You can also refefine TEMP environment variable on the Windows level.

Best regards,

Yegor Yarko
Project Manager (TeamCity)
JetBrains, Inc
"Develop with pleasure!"

Message was edited by: Yegor Yarko

Comment actions Permalink

Though redefining TEMP environment variable (on "User variables" as opposed to "System variables") on the Windows level works, I would rather have it done on TC level rather then globally.

But I can't find buildAgent.conf file.

C:\>dir C:\TeamCity\buildAgent\conf
12/25/2008  04:10 PM             1,471
01/07/2009  11:30 AM               397
01/07/2009  11:28 AM                33
12/25/2008  04:10 PM             5,359 log4j.dtd
12/25/2008  04:10 PM             4,140 teamcity-agent-log4j.xml

Using (TeamCity Enterprise Version 4.0.1 (build 8171)).
Searched both directories:
1.  (C:\TeamCity) main installation directory
2.  (C:\Control\TeamCity) configuration directory (setup during installation).  This is were all the build configurations are.

Should I simply create that file?  Or add env.TEMP into  Or some other file?

P.S.  I voted on the bug in Tracker (TW-6672).
If I can configure TC as Yegor suggested then this issue would be under "desirable" priority for me.
The "very high", from my stand point is, (TW-6508).

Comment actions Permalink

You should use not buildAgent.conf

Comment actions Permalink

Pavel, Yegor - thanks much.
Change to works.

Issue resolved.


Please sign in to leave a comment.