SoFunction
Updated on 2025-04-10

VBS tutorial: Attributes-AvailableSpace Attributes

AvailableSpace Properties

Returns the available space size for the specified drive or network share to the user.

object.AvailableSpace

objectShould beDriveThe name of the object.

illustrate

AvailableSpaceProperties andFreeSpaceThe values ​​returned by the attribute are basically the same. For computer systems that support limits, the values ​​returned by these two properties differ.

The following code shows how to use itAvailableSpaceproperty:

Function ShowAvailableSpace(drvPath)  Dim fso, d, s  Set fso = CreateObject("")  Set d = ((drvPath))  s = "Drive " & UCase(drvPath) & " - "   s = s &   & "<BR>"  s = s & "Available space:" & FormatNumber(/1024, 0)   s = s & " Kbytes"  ShowAvailableSpace = sEnd Function