Sign in to follow this  
Followers 0
gregnottage

DriveGetDrive all on 1 page

4 posts in this topic

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Oh superb!! Thanks so much for the swift response - it's HUGELY appreciated ;-)

Kindest Regards,

Greg.

Share this post


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
Sign in to follow this  
Followers 0