I have a file called test.txt in jenkins workspace directory for the pipeline job being run on windows slave agent. The contents of the file is as :-
test1=abc
test2=xyz
Now i am running a pipeline groovy job which is :-
node () {
bat '''FOR /F "tokens=2 delims==" %%a IN ('find "test2" ^<%WORKSPACE%\\test.txt') DO SET test2value=%%a
echo %test2value%'''
}
If i execute the same script using windows command line on the same windows slave machine it works just fine but in jenkins groovy it says file test2 not found. I am unable to figure out how to use this in this scenario. The actual expected result of this pipeline should be xyz Kindly help