$disk

From Scriptwiki
Jump to: navigation, search

Returns information about a hard-disk drive or partition.

$disk(path|N)[.type|.free|.label|.size|.unc|.path]
  • The first parameter is either the drive path (such as C:) or the number of the drive (0 for total number, 1 for the first, etc)
  • Returns:
    • For no property, it returns $true or $false based on whether or not the specified drive is accessable. For example, if drive 1 is A: (Floppy disk) then it would return $false if no disk were in the drive, and $true if there was.
    • .type returns the type of drive. For example, A: would return "removable" and C: "fixed"
    • .free returns the number of free bytes. 0 if unaccessible. Can be formated and converted with $bytes.
    • .label returns the drive label.
    • .size returns the total size of the drive (free + used) in bytes. Can be formated and converted with $bytes.
    • .unc returns the path for a network drive. If the drive is not a network drive, $null is returned.
    • .path returns the path to the drive. For example $disk(1).path and $disk(A:).path would each return "A:\"