我找到了這篇關于獲取已安裝修補程式串列的帖子,wmic qfe list full@Hackoo 回復如下:
@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 }
這絕對可以正常作業,但也可以合并描述和InstalledOn wmic 資訊,以便輸出顯示以下內容:
HotfixID InstalledOn 描述
使用上面的代碼,我可以單獨獲取每個但不能全部獲取,因為 InstalledOn / Description 似乎重復了第一個值。
然后,我超出了我的知識水平并嘗試了以下操作(不起作用):
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%
在此希望您能提供幫助。
uj5u.com熱心網友回復:
這有幫助嗎?
@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
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/401222.html
上一篇:PHP中的非法字串偏移“動作”
下一篇:處理bash腳本中的特殊字符
