这个工具也很强,能不能放出来用用 本帖最后由 chzj589 于 2021-8-16 15:56 编辑
zpmc123 发表于 2021-8-16 12:21
楼主强!WIN10正常使用!
这个代码是以前做UDEFI安装工具,单要抽出来还得有点时间。
本帖最后由 chzj589 于 2021-8-17 18:00 编辑
zpmc123 发表于 2021-8-16 12:21
楼主强!WIN10正常使用!
刚学AU3不久时写的,写得很乱。现打开代码都看不懂了。抽出来不能运行了,关联太多。
给个磁盘信息主代码:
#include <Array.au3>
Local $ii = 0, $x1, $x2
$Disk = DriveGetDrive("ALL");返回一个含有指定驱动器盘符的数组
If DriveGetDrive("Removable") = 0 Then
;MsgBox(0, "本地磁盘", "没有发现可移动磁盘 ", 1)
$x2 = 0
Else
Global $Disk2 = DriveGetDrive("Removable")
$x2 = $Disk2
EndIf
If DriveGetDrive("FIXED") = 0 Then
MsgBox(0, "本地磁盘", "没有发现磁盘 ")
Else
Global $Disk1 = DriveGetDrive("FIXED")
$x1 = $Disk1
EndIf
Local $x = $x1 + $x2
Local $Edit1X11[$x]
If Not @error Then
For $i = 1 To $Disk
Dim $Disks[$Disk + 1]
$Disks[$i] = StringUpper($Disk[$i]);转换字符串为大写字母
$DriveType = DriveGetType($Disk[$i]);驱动器的类型
$DriveFile = DriveGetFileSystem($Disk[$i]);格式
$DriveFree = DriveSpaceFree($Disk[$i]);可用空间
$DriveFreeGB = ByteConversion($DriveFree);单位转换
$DriveTotal = DriveSpaceTotal($Disk[$i]);总大小
$DriveTotalGB = ByteConversion($DriveTotal);单位转换
If $DriveType = "Unknown" Then;判断驱动器是否 Unknown 类型
ElseIf $DriveType = "Removable" Then;判断驱动器是否 Removable 类型
$DriveTypeS = "可移动驱动器"
$Edit1X11[$ii] = $DriveTypeS & " | " & $DriveFile & " | " & $DriveFreeGB & " | " & $DriveTotalGB
$ii += 1
ElseIf $DriveType = "Fixed" Then;判断驱动器是否 Fixed 类型
;-----------------------------------------------------------------------------------------------
$DriveTypeS = "本地磁盘"
$Edit1X11[$ii] = $DriveTypeS & " | " & $DriveFile & " | " & $DriveFreeGB & " | " & $DriveTotalGB
;MsgBox(0, $DriveTypeS & $i, $DriveTypeS & "|" & $DriveFile & "|" & $DriveFreeGB & "|" & $DriveTotalGB)
$ii += 1
EndIf
Next
_ArrayDisplay($Edit1X11, "磁盘信息")
EndIf
Func ByteConversion($lBytes)
If $lBytes < 1024 Then
Return Round($lBytes, 2) & "MB"
ElseIf $lBytes < 1048576 Then
Return Round($lBytes / 1024, 2) & "GB"
EndIf
EndFunc ;==>ByteConversion
页:
1
[2]