回复 27# austere #include <MsgBoxConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <Process.au3>
If FileExists(@TempDir & '\disk\') = 0 Then _FileCreate(@TempDir & '\disk\')
$file = _FileCreate(@TempDir & '\disk\list.txt')
$file1 = FileOpen($file, 1)
FileWrite(@TempDir & '\disk\list.txt', 'list disk')
_RunDos('cmd.exe /c diskpart.exe /s ' & @TempDir & '\disk\list.txt >'& @TempDir & '\disk\123.txt')
Local $aArray = FileReadToArray(@TempDir & "\disk\123.txt")
Local $asd = _ArrayFindAll($aArray, '磁盘 0', Default, Default, 1, 1, 2)
$ss = StringStripWS($aArray[$asd[0]], 8)
Local $sss = StringRight($ss, 1)
If $sss == '*' Then
msgbox(0,'','当前为GPT硬盘启动',1)
_RunDos('cmd.exe /c bcdboot c:\windows /l zh-cn') ;确定C盘是GPT磁盘并将EFI启动文件夹写入活动区ESP盘
Else
MsgBox(0,'','当前为MBR硬盘启动',1)
_RunDos('cmd.exe /c bcdboot c:\windows /l zh-cn /s c:') ;确定C盘是MBR磁盘并将EFI启动文件夹写入活动区C盘,若MBR PE启动则将Boot启动文件夹写入活动区C盘
If FileExists(@HomeDrive & '\EFI') Then
FileSetAttrib('C:\EFI','+RSH')
EndIf
EndIf
|