Sudiro Posted October 30, 2016 Posted October 30, 2016 Dear All.. Try Read Disk Number with diskpart.. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #RequireAdmin $DiskPartGUI = GUICreate("DiskPart List..", 359, 94, -1, -1) $ListDisk = GUICtrlCreateCombo("", 16, 16, 129, 25) $DetailDisk = GUICtrlCreateButton("DetailDisk", 152, 16, 193, 25) $ShowDetailDisk = GUICtrlCreateButton("Press Detail Disk To See Detail Partition 1 In Disk <num>...!!!", 16, 56, 329, 25) ;;===================================================================================================== $DiskPart = Run(@ComSpec & " /k " & "diskpart", @SystemDir,@SW_HIDE,$STDIN_CHILD + $STDOUT_CHILD) StdinWrite($DiskPart, "list Disk" ) StdinWrite($DiskPart) Local $ListD While True $ListD &= StdoutRead($DiskPart & @CRLF) If @error Then ExitLoop Sleep(25) WEnd $DiskNum = StringRegExp($ListD,"(?i)disk [\d]+",3) $SizeD = StringRegExp($ListD,"(?i)disk [\d](.*)",3) For $i = 0 To UBound($DiskNum) - 1 if @OSVersion = "WIN_10" Or "WIN_81" Or "WIN_8" Or "WIN_7" Or "WIN_VISTA" Then $SizeDisk = StringRight(StringLeft($SizeD[$i], 26), 7) if @OSVersion = "WIN_XP" or "WIN_XPe" Then $SizeDisk = StringRight(StringLeft($SizeD[$i], 23), 7) ;$SizeDisk = StringRight(StringLeft($SizeD[$i], 26), 7) GUICtrlSetData($ListDisk, $DiskNum[$i] &" : "&$SizeDisk, $DiskNum[$i] &" : "&$SizeDisk) Next ;;====================================================================================================== GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $DetailDisk $Ddisk = GUICtrlRead($ListDisk) $StrinL = StringLeft($Ddisk, 6) $DPrDiskPart = Run(@ComSpec & " /k " & "diskpart", @SystemDir,@SW_HIDE,$STDIN_CHILD + $STDOUT_CHILD) StdinWrite($DPrDiskPart, "Select "&$StrinL & @CRLF &"select partition 1"& @CRLF &"detail partition") StdinWrite($DPrDiskPart) Local $Part While True $Part &= StdoutRead($DPrDiskPart & @CRLF) If @error Then ExitLoop Sleep(25) WEnd $sVolume = StringRegExp($Part,"(?i)volume [\d]+",3) $sVolum = StringRegExp($Part,"(?i)volume [\d](.*)",3) For $i = 0 To UBound($sVolume) - 1 For $i = 0 To UBound($sVolum) - 1 $Vol = StringReplace($sVolume[$i],"volume ","Volume HDD ") $Ltr = StringRight(StringLeft($sVolum[$i], 7), 2) $Label = StringRight(StringLeft($sVolum[$i], 22), 13) $FileSystem = StringRight(StringLeft($sVolum[$i], 29), 7) $Size = StringRight(StringLeft($sVolum[$i], 50), 9) GUICtrlSetData($ShowDetailDisk, $Ltr&": "&$Label&" FS: "&$FileSystem&" P1: "&$Size&" In "&$Ddisk) Next Next EndSwitch WEnd Have a a probelm.. When take if @osversion $listdisk only show size number without GB, MB, KB.. How to resolve the script.?/
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now