Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  GetFreeDriveSize  

 Content of GetFreeDriveSize.vbs
MD5 Hash: 10E0F1A1D5FD395FC7AFBFF12EC30742

msgbox GetDriveSize("C:", 1, 2) & " Bytes"

msgbox GetDriveSize("C:", 2, 2) & " KB"

msgbox GetDriveSize("C:", 3, 2) & " MB"

msgbox GetDriveSize("C:", 4, 2) & " GB"



' --------------------------------------------
Function GetDriveSize(sDrive, iFormat, iRound)

Dim vDriveSize
Dim bObjectCreate : bObjectCreate = false

If not IsObject(ofso) then
Dim ofso : Set ofso = CreateObject("Scripting.FileSystemObject")
bObjectCreate = True
End if

If ofso.DriveExists(sDrive) then

Select Case iFormat

Case 1 '---Return Bytes
vDriveSize = Round(ofso.GetDrive(sDrive).FreeSpace,iRound)

Case 2 '---Return KB
vDriveSize = Round((ofso.GetDrive(sDrive).FreeSpace/1024),iRound)

Case 3 '---Return MB
vDriveSize = Round(((ofso.GetDrive(sDrive).FreeSpace/1024)/1024),iRound)

Case 4 '---Return GB
vDriveSize = Round((((ofso.GetDrive(sDrive).FreeSpace/1024)/1024)/1024),iRound)
End Select

Else
If IsObject(ofso) and bObjectCreate then Set ofso = Nothing
GetDriveSize = -1
End if

If IsObject(ofso) and bObjectCreate then Set ofso = Nothing
GetDriveSize = vDriveSize

End Function

   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a