in for /f trying save result to var in build step
@echo off
for /f "tokens=9,10 delims=; " %%%%s in ('findstr ".crcSection" C:\TeamCity\buildAgent\work\56959e35e309dd04\Sources\FW\PCD_912\LPCxpresso\App\Release\crcdef.h') do (
set z=%%%%s
echo !z!
)
report from
[13:37:47] : Step 1/4: test (Command Line)
[13:37:47]i: [Step 1/4] Content of C:\TeamCity\buildAgent\temp\agentTmp\custom_script7855894024857985357.cmd file:
@echo off
rem This is a custom script written by TeamCity using windows-1255 charset.
@echo off
for /f "tokens=9,10 delims=; " %%s in ('findstr ".crcSection" C:\TeamCity\buildAgent\work\56959e35e309dd04\Sources\FW\PCD_912\LPCxpresso\App\Release\crcdef.h') do (
set z=%%s
echo !z!
)
echo !z!
[13:37:47] : [Step 1/4] Starting: C:\TeamCity\buildAgent\temp\agentTmp\custom_script7855894024857985357.cmd
[13:37:47] : [Step 1/4] in directory: C:\TeamCity\buildAgent\work\56959e35e309dd04
[13:37:47] : [Step 1/4] !z!
[13:37:47] : [Step 1/4] !z!
[13:37:47] : [Step 1/4] Process exited with code 0
echo !z!
Please sign in to leave a comment.
Hi,
It looks like maybe you have the wrong character surrounding your variable in your echo statement. Try using the following:
If you just run this from a command prompt on the build agent computer, does it output the expected result?