Jump to content

Recommended Posts

Posted

Hi,

i want to know if it's possible to write a script who can detect if a drive exist?

I see a function "fileexists" but not "driveexists" so ....

thank you

Posted

$var = DriveGetDrive( "all" )
If NOT @error Then
    MsgBox(4096,"", "Found " & $var[0] & " drives")
    For $i = 1 to $var[0]
        MsgBox(4096,"Drive " & $i, $var[$i])
    Next
EndIf

That tell you want drives there are, you can then search the array for the drive letter your looking for.

qq

Posted

in fact i am an administrator,

We have roaming user and they hort

Help and they have got thinkpad.They have also station and they can plug their thinkpad on the station. the station have a drive of backup and i want make a script that can detect if the drive is here and if it's right that can copy user's data on this drive.

Posted (edited)

$var = DriveGetDrive( "all" )
$drive = "a:"; Change it to your drive letter
If NOT @error Then
   For $i = 1 to $var[0]
      If $var[$i] = $drive Then
       ; Copy data code
      EndIf
   Next
EndIf

You can change what DriveGetDrive() searchs for using

"ALL", "CDROM", "REMOVABLE", "FIXED", "NETWORK", "RAMDISK", or "UNKNOWN"

eg. DriveGetDrive( "REMOVABLE" ) will only search the removeable drives
Edited by Burrup

qq

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...