使用 ImageX 和 WIM 重建 HDD 后,BCD 有时会损坏。因此,我需要从在命令提示符下无人值守运行的脚本重新构建 BCD。
下面的代码在手动输入时完成了这项工作。我需要帮助来自动化它(进一步参见下面的代码示例):
bootrec.exe /fixmbr
bootsect.exe /nt60 all /force
attrib -h -s C:\boot\BCD
del C:\boot\BCD
bcdedit.exe /createstore c:\boot\bcd.temp
bcdedit.exe /store c:\boot\bcd.temp /create {bootmgr} /d "Windows Boot Manager"
bcdedit.exe /import c:\boot\bcd.temp
bcdedit.exe /set {bootmgr} device partition=C:
bcdedit.exe /timeout 10
attrib -h -s C:\boot\bcd.temp
del c:\boot\bcd.temp
bcdedit.exe /create /d "Microsoft Windows" /application osloader
bcdedit.exe /set {GUID} device partition=C:
bcdedit.exe /set {GUID} osdevice partition=C:
bcdedit.exe /set {GUID} path \Windows\system32\winload.exe
bcdedit.exe /set {GUID} systemroot \Windows
bcdedit.exe /displayorder {GUID}
如上所述,我需要在无人值守的命令提示符下运行它。最后第 6 条语句“bcdedit.exe /create /d "Microsoft Windows" /application osloader”的输出是新创建的 GUID。以下命令中需要此 ID。
如何将这个新的 GUID 从 bcdedit 加载到可以在以下代码中调用的变量?
最好的问候 Henrik V. Nielsen