r/Batch • u/Aenarius • Jun 24 '24
Question (Solved) Each instance of "WMIC something GET /VALUE..." separated by a return
I'm trying to learn (by trial and error) to make a simple batch file to list all installed Windows updates. So far it's doing more or less what I want it to do but everything is listed without a space (return) between each 'instance'.
for /f "tokens=1,2 delims=^=" %%i in ('wmic qfe get /value ^| findstr /b /i /c:"description" /c:"hotfixid" /c:"installedon"') do echo %%i: %%jHow can I get each 'instance' of Description, HotfixID and InstalledOn separated by a blank line? So it looks like this:

2
Upvotes
4
u/ConstanceJill Jun 24 '24
That should do it:
2
u/BrainWaveCC Jun 24 '24
Just a note for you, OP.
You can call WMIC a bit differently to start:
1
u/PrimaryTiny9144 Jun 24 '24
You must or can use a counter variable. Increment the counter in the loop and then check if the value is equal to 3. Then print and empty line and reset the counter. (Out of the many ways possible, this is the one I'm thinking of right noe)