我正在使用一臺雙核Windows機器,上面有不同版本的Windows(8.1和10),我需要一種方法來記錄每個安裝的唯一GUID識別符號。
目前我只能匯出整個bcdedit,這不是我想要的,我如何才能將GUID識別符號和描述只匯出到一個txt檔案中?
uj5u.com熱心網友回復:
正如@Squashman在評論中回答的那樣,獲得目標的最簡單方法是
c:WindowsSystem32cdedit.exe /enum |findstr "den des"
識別符號 {bootmgr}
描述 Windows 啟動管理器
識別符號 {current}
描述 Windows 10
identifier {cace6f08-28f0-11eb-b3c4-4c72b9b04518}
描述Windows 10
你問的是如何洗掉最上面的兩個條目,所以要多用少用:-)
c:WindowsSystem32cdedit.exe /enum |findstr "den des" |more 2
識別符號 {current}
描述 Windows 10
identifier {cace6f08-28f0-11eb-b3c4-4c72b9b04518}
描述 Windows 10
如果你的下一個問題是2 2,那么就用4
c:WindowsSystem32cdedit.exe /enum |findstr "den des" |more 4 > c:output.txt
輸出被發送到一個檔案中,因為你是在一個未知的但很可能是受保護的區域中運行的,我只是把它發送到c:根目錄中,改到臨時檔案夾或其他需要的位置。你可以用型別來檢查輸出。
C:Windowssystem32>type c:output.txt
identifier {cace6f08-28f0-11eb-b3c4-4c72b9b04518}
描述 Windows 10
并且
For /F "Tokens=2*" %G In ('%SystemRoot%System32findstr.exe "e" c:output.txt') Do @echo %~G %~H > c:out2.txt
然后將使用型別回傳
C:Windowssystem32>type c:out2.txt
{cace6f08-28f0-11eb-b3c4-4c72b9b04518}
Windows 10
如果你是作為批處理檔案添加在一起,請記住%var:-
RunMe.cmd (必須以管理員身份運行,否則你會看到bcedit拒絕訪問會導致 "系統無法找到指定的檔案。")
@echo off
c:WindowsSystem32cdedit.exe /enum |findstr "den des" |more 4> "%temp% empout.txt"
if exist "%temp% empout2.txt" del "%temp% empout2.txt"
For /F "Tokens=2*" %%G In ('%SystemRoot%System32findstr.exe "e" "%temp% empout.txt"') Do @echo %%~G %%~H >> "%temp% empout2.txt"
輸入"%temp% empout2.txt"。
c:WindowsSystem32>RunMe.cmd
{cace6f08-28f0-11eb-b3c4-4c72b9b04518}
Windows 10
注意上述結果取決于我測驗中的6個簡單條目,more 4洗掉了前4個,這不是一個處理bcedit.exe輸出的不同行數的強大解決方案。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/315731.html
標籤:

