Process exited with code 255 when running on command prompt through TeamCity

Viewed 2515

The following command

@Set "installed_version=" & @(FOR /F %a IN ('curl 192.168.1.151:5000/getversion') DO @SET installed_version=%a)

is failing when running on a Windows agent in Teamcity with error

) was unexpected at this time. Process exited with code 255

However, the same command runs smoothly when running on a command prompt on my local Windows 10 machine. The teamcity agent is a Windows Server 2008 R2, version 6.1.

What am I doing wrong?

1 Answers

It turns out, % has to be escaped when in a bat file, so it should be %%. At the same time, in Kotlin DSL % also needs to be escaped, so we end up with %%%%.

Related