xcopy exited with code 9009

Hello,

One of our TeamCity projects has dependencies on network shared drive, so we add following environment variable as a build parameter:

env.PATH = %env.PATH%;\\path\to\their\libraries

However, the build failed with error: "The command "xcopy /f /i /y "......" exited with code 9009."

We then change the env.PATH = C:\Windows\System32;\\path\to\their\libraries, and the build works.

But we really don't think we should manually add C:\Windows\System32 to the env.PATH

Do you know what might cause this and how to fix it?

Thanks,

Ge

 

 

11 comments
Comment actions Permalink

Hi Ge,

According to a quick google search, it seems that the error code 9009 means that the script cannot find the path to the xcopy executable: http://stackoverflow.com/questions/1351830/what-does-exited-with-code-9009-mean-during-this-build

You can check what's in the path for the agent that runs the builds, but if C:\Windows\System32 isn't in it, it seems you are going to have to add it. You can also add it to the agent startup script instead of the build script, so it's available for other builds that also require it. Info on how to customize the agent's start parameters here: https://confluence.jetbrains.com/display/TCD10/Build+Agent+Configuration

0
Comment actions Permalink

Thanks for the response!

The 'C:\Windows\System32' was in the agent PATH. In fact, we only see this error when users try to append to %env.PATH% in the build script.

If we run build without appending path, the xcopy works fine.

 

 

0
Comment actions Permalink

That's strange. Can you show here (with a screenshot, for example), on a failed build, the content of the PATH variable at the end of the build? To do that, go to the build results page, parameters tab, environment variables section.

0
Comment actions Permalink

Hi Ge,

How are you setting up the parameter? It seems like it's taking the literal value "%env.Path%" instead of the value of the variable, and that's why it's not setting it up properly

0
Comment actions Permalink

I set up this from project's parameter section: Parameters --> Add new parameter -->

Name: env.PATH

Kind: Environment varilable(env.)

Value: %env.PATH%;\\bala01\software\RV\Current64\bin

0
Comment actions Permalink

Which TeamCity version are you running? I have just tried in 2017.1.1 and it seems to be working just fine, env.PATH gets translated to the PATH environment adding all together.

I do see an issue with the screenshot. You seem to have set up "env.Path" instead of "env.PATH". Variable names are case sensitive. Could you double check if using env.PATH instead of env.Path works? Or do you already have env.PATH and it's only being reported as env.Path?

0
Comment actions Permalink

Our version is 9.1.6

The initial value was all upper case  "%env.PATH%;\\bala01\software\RV\Current64\bin"

The camel case "env.Path" was because we tried to tweak the value to see if there were any difference, but got the same result.

We then updated the value to be  "C:\Windows\System32;\\bala01\software\RV\Current64\bin;" and the build works.

0
Comment actions Permalink

Just use ''%systemroot%\system32\''  to replace ''C:\Windows\System32'', it will make your code universal for use in Windows environment.

0
Comment actions Permalink

Hi Ge,

The fact that you are using 9.1.6 I think is the issue here. See the issue in our tracker: https://youtrack.jetbrains.com/issue/TW-42181

If your PATH already contains the character '%', it will not work. Workaround is to specify the path you actually need, solution is to upgrade to a newer release where it was fixed (10.0.3 at least)

0
Comment actions Permalink

Thanks! That explains all.

0

Please sign in to leave a comment.