This is a Windows cmd.exe question. Trying to set a variable and then using && to include another command referencing that variable in one command line does not work. The variable is not set until the next line is processed.
Steps to reproduce:
set X=1 && echo %X%
%X%
echo %X%
1
set X=2 && echo %X%
1
echo %X%
2
Is there a way to make this work as expected?