确定磁盘是否可写磁盘.
#Include <WinAPIEx.au3>
_WinAPI_IsWritable ( $sDrive )
$sDrive | 磁盘的驱动器号. 如 D:, E:, 等等. |
成功: | 返回 1 - 磁盘可写. |
返回 0 - 不可写. | |
失败: | 返回 0,并设置@error标志为非 0 值. |
在MSDN中搜索
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $Text, $Drive = DriveGetDrive('ALL')
If IsArray($Drive) Then
For $i = 1 To $Drive[0]
If _WinAPI_IsWritable($Drive[$i]) Then
$Text = 'Writable'
Else
$Text = 'Not writable'
EndIf
If Not @error Then
ConsoleWrite(StringUpper($Drive[$i]) & ' => ' & $Text & @CR)
EndIf
Next
EndIf