Home > Blockchain >  Viewing a list of Installed Hotfixes/Patches using wmic (HotfixID, InstalledOn and Description)
Viewing a list of Installed Hotfixes/Patches using wmic (HotfixID, InstalledOn and Description)

Time:01-03

I found this post with regard to getting a list of installed Hotfixes using wmic qfe list full and @Hackoo replied with the following:

@echo off
Title wmic to get HotfixID
Setlocal EnableDelayedExpansion
echo "patches" : {
set "patches=wmic qfe get HotfixID"
for /f "skip=1" %%i in ('%patches%') do for /f "delims=" %%j in ("%%i") do (
    set /a count=count 1
    echo "!count!" : "%%j",
)
echo }

This works absolutely fine but is it also possible to incorporate the Description and InstalledOn wmic information as well so that the output displays the following:

HotfixID InstalledOn Description

Using the above code I can get each individually but not all together as the InstalledOn / Description seem to repeat the first value.

I then stepped right outside my level of knowledge and tried the following (which does not work):

for /f "tokens=1,2,3 skip=1 delims=," %%a in ('%SystemRoot%\System32\wbem\wmic.exe qfe get HotfixID,InstalledOn,Description') do (
    set "hotfix_number=%%~a"
    set "hotfix_installed=%%~b"
    set "hotfix_description=%%~c"
)
echo %hotfix_number% installed on %hotfix_installed% - %hotfix_description%

Here's hoping you are able to assist.

CodePudding user response:

Does this help?

@For /F "Skip=2 Tokens=1,* Delims=," %%G In ('%SystemRoot%\System32\wbem\WMIC.exe QFE Get Description^, HotFixID^, InstalledOn /Format:CSV 2^>NUL') Do @For /F "Tokens=1-3 Delims=," %%I In ("%%H") Do @Echo %%J installed on %%K - %%I
  • Related