Why does this bat file forget %%a after :theFound? I am trying to understand how For /f works, but %%a is forgotten after the :theFound
Thanks for looking.
FOR /F %%a in (c:\temp\computers.txt) do (
echo %%a
set comPort=0
:comLoop
set /a comPort=%comPort%+1
reg query \\%%a\HKEY_LOCAL_MACHINE\SOFTWARE\Pergamon\AKT\Dienst\XFS\PASION_CM24_COM%comPort%
if errorlevel 0 goto theFound
if %comPort% LSS 10 goto comLoop
echo No CRU found >>c:\temp\output1.txt
:theFound
reg query \\%%a\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOSA/XFS_ROOT\SERVICE_PROVIDERS\PASION_CM24_COM%comPort%\Firmware>>c:\temp\output1.txt
)