I have a text file with MS Windows update names:
...
KB3072019
KB3044374
KB3011780
KB3083711
...
And having a folder with downloaded updates:
My goal is to check wether an update is downloaded or not according to the text file.
@echo off
set /a x=0
setlocal ENABLEDELAYEDEXPANSION
for /F "tokens=*" %%A in (d:\WindowsUpdate.log) do (
set /a x=x+1
echo Update number !x!, name %%A, state:
IF EXIST d:\!Del\Win8Updates_x64\Merged\*%%A*.cab (echo Downloaded) ELSE (echo MISSING!)
)
pause
The output should be like this:
Update number 83, name KB3045999, state:
MISSING
Update number 84, name KB3045746, state:
Downloaded
Update number 85, name KB3066441, state:
Downloaded
Update number 86, name KB3071663, state:
MISSING
But actually it looks like this:
Update number 83, name KB3045999, state:
MISSING
Update number 84, name KB3045746, state:
MISSING
Update number 85, name KB3066441, state:
MISSING
Update number 86, name KB3071663, state:
MISSING
My question: why does %%A not work inside the if statement?
Important: I don't want to skip the line numbers, because they're representing the order of the updates. Later I'll modify the script to copy/move the existing updates to another location prefixed with it's order number, like 83_windows8.1-kb3045999-x64.cab
Aucun commentaire:
Enregistrer un commentaire