函数参考


_WinAPI_GetVolumeInformation

Retrieves information about the file system and volume associated with the specified root directory.

#Include <WinAPIEx.au3>
_WinAPI_GetVolumeInformation ( [$sRoot] )

参数

$sRoot [可选参数] The root directory of the volume to be described. If this parameter is empty string, the root
of the current directory is used. A trailing backslash is required. For example, you specify
"\\MyServer\MyShare" as "\\MyServer\MyShare\", or the "C" drive as "C:\".

返回值

Success The array that contains the following information:
[0] - The name of a volume.
[2] - The serial number of a volume.
[1] - The maximum length, in TCHARs, of a file name component that a file system supports.
[3] - The flags associated with the file system ($FILE_*).
[4] - The name of the file system, for example, "FAT", "NTFS", etc.
失败: 返回 0 并设置 @error 标志为非 0 值.

注意/说明

When a user attempts to get information about a floppy drive that does not have a floppy disk, or a CD-ROM
drive that does not have a compact disc, the system displays a message box for the user to insert a floppy disk
or a compact disc, respectively. To prevent the system from displaying this message box, call the
_WinAPI_SetErrorMode() function with $SEM_FAILCRITICALERRORS.

相关

详情参考

在MSDN中搜索


示例/演示


#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

Global $Data = _WinAPI_GetVolumeInformation()

ConsoleWrite('Volume name: ' & $Data[0] & @CR)
ConsoleWrite('File system: ' & $Data[4] & @CR)
ConsoleWrite('Serial number: ' & $Data[1] & @CR)
ConsoleWrite('File name length: ' & $Data[2] & @CR)
ConsoleWrite('Flags: 0x' & Hex($Data[3]) & @CR)