Jump to content

DriveGetDrive all on 1 page


Recommended Posts

Hi Guys,

I've adapted the help file code to display the relevant hard drive settings in a message box. I'd like to make all of the drive details appear on one box. Please can you tell me what changes I need to make to my script to display all the drive data on one message box?

Here's my script:

CODE
;Check partition sizes and display in a msgbox

$var = DriveGetDrive( "fixed" )

If NOT @error Then

For $i = 1 to $var[0]

$Total = StringFormat("%.2f",(DriveSpaceTotal($var[$i]))/1024); Total size in GB

$Free = StringFormat("%.2f",(DriveSpaceFree($var[$i]))/1024); Free space in GB

$Used = $Total - $Free ; Calculate difference which is used space in GB

;Display in msgbox

MsgBox (0, "Drive details", "Drive " & $i & " = " & $var[$i] & @CRLF & @CRLF & " Used Space = " & $Used & " GB" & @CRLF & " Free Space = " & $Free & " GB" & @CRLF & @CRLF & " Partition Size = " & $Total & " GB")

Next

EndIf

Thanks in advance ;-)

Kind Regards,

Greg.

Link to comment
Share on other sites

$var = DriveGetDrive( "fixed" )
If NOT @error Then
$string = ""
For $i = 1 to $var[0]
$Total = StringFormat("%.2f",(DriveSpaceTotal($var[$i]))/1024); Total size in GB
    $Free = StringFormat("%.2f",(DriveSpaceFree($var[$i]))/1024); Free space in GB
    $Used = $Total - $Free; Calculate difference which is used space in GB
;Display in msgbox
    $string &= "Drive " & $i & " = " & $var[$i] & @CRLF & @CRLF & " Used Space = " & $Used & " GB" & @CRLF & " Free Space = " & $Free & " GB" & @CRLF & @CRLF & " Partition Size = " & $Total & " GB" & @crlf & @crlf
Next

MsgBox (0, "Drive details",$string)
EndIf

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...