Sign in to follow this  
Followers 0
mithandir1

Need help with DriveGetDrive

5 posts in this topic

What I want to do is use DriveGetGrive("removable") and get a list of all drive letters that are removable. For instance if 2 USB flash drives are drive F: and drive G: I want to be able to assign a value such as $fdive = 1, $Gdrive = 1. How can I accomplish this? I have searched the forum and read through the help file but I can't figure out how to pull what I need out of the array. I have been stumped for 2 days now so any help would be greatly appreciated.

Share this post


Link to post
Share on other sites



If you want dynamic variables you will need Assign() and Eval() but that's really messy. Why not use the nice and friendly array?

If you're having trouble understanding arrays, then check the article about arrays in the wiki.

Share this post


Link to post
Share on other sites

This is usefull i think

$varall = DriveGetDrive("all")
    $text = ""
    for $i = 1 to $varall[0]
        $vartype = DriveGetType($varall[$i])
        $text = $text & "Driveletter " & $varall[$i] & " is type " & $vartype & @CRLF
    Next
    MsgBox(1, "", $text)

Share this post


Link to post
Share on other sites

If you want dynamic variables you will need Assign() and Eval() but that's really messy. Why not use the nice and friendly array?

If you're having trouble understanding arrays, then check the article about arrays in the wiki.

Dynamic variables aren't exactly what I need(I have a feeling this way beyond my noobish abilities) . I do not care to have a list of variables set to zero. Such as $fdive = 0 $gdrive= 0 and then change them to $fdive = 1 $gdrive =1 if they are present. What I need to know is how to determine if a drive is removable and then perform function based on that. The script I am working on is on my computer at school so I can't give an exact example of what I am trying to do. I am currently using a long list of drivegettypes to see which drives are removable and then calling a function when a drive is found. I was wanting to know how to accomplish this using drivegetdrive.

Share this post


Link to post
Share on other sites

What I need to know is how to determine if a drive is removable and then perform function based on that.

Sounds to me like you need to use the function DriveGetType and use it in an IF statement

ConsoleWrite(DriveGetType("C:/"))

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