Jump to content

How can i get exacly size of a Drive showed in My Computer

Recommended Posts

Hi guys i having issues to get exacly size showed in my computer, my script:

;Retorna o drive no formato D:
;$sDrive = StringLeft(@ScriptFullPath,3)
$sDrive = "F:\"

;Retorna a label do drive no formato <Sistema>
$sDriveLabel = DriveGetLabel($sDrive)

;Retorna o espaço livre do drive em megabytes como um float
$iDriveSpaceFree = DriveSpaceFree($sDrive)

;Retorna o espaço total do drive em megabytes como um float
$iDriveSpaceTotal = DriveSpaceTotal($sDrive)

;Retorna o espaço ocupado
$iDriveSpaceUsed = $iDriveSpaceTotal - $iDriveSpaceFree

; Espaço Ocupado x 100 / Espaço Total
$iPercent = ( $iDriveSpaceUsed * 100 ) / $iDriveSpaceTotal

ConsoleWrite(@CRLF & Round($iDriveSpaceFree / 1024,2) & " GB livre(s) de " & Round($iDriveSpaceTotal / 1024,2) & " GB" & @CRLF)


With the same script i get a wrong a correct results


In my computer:

92,0 / 98,9

In AutoIt:

92.01 / 98.95



In my computer:

7,28 / 7,91

In AutoIt:

7.28 / 7.91


thanks in advance

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...