AutoIt Forums: Script To Detect All Available Drives On PC..? - AutoIt Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Script To Detect All Available Drives On PC..?

#1 User is offline   cypher175 

  • Mass Spammer!
  • PipPipPipPip
  • Group: Full Members
  • Posts: 407
  • Joined: 30-June 08

Posted 05 November 2008 - 04:44 AM

Anybody know how I would go about coding a script to detect all the available drives on a PC: Fixed, Removable, USB, CD-DVD Ect..
And for each drive found I want to copy a file over to it..

Anyone know what Commands or Functions I would need to use for something like this..??

#2 User is offline   spudw2k 

  • i dunno what i'm doing
  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 731
  • Joined: 16-August 07
  • Gender:Male
  • Location:CA

Posted 05 November 2008 - 05:20 AM

View Postcypher175, on Nov 4 2008, 07:44 PM, said:

Anyone know what Commands or Functions I would need to use for something like this..??
Search the helpfile for DriveGetDrives()

This post has been edited by spudw2k: 05 November 2008 - 05:20 AM


#3 User is offline   cypher175 

  • Mass Spammer!
  • PipPipPipPip
  • Group: Full Members
  • Posts: 407
  • Joined: 30-June 08

Posted 05 November 2008 - 06:24 AM

ok thanks...
so far i got this, but its not working though, whats wrong with it..??
I think its the "Drive" Variable, what am i suppose to use instead, so it copies "C:\0\1.txt" to all found drives..??

Quote

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


#4 User is offline   UltraFine 

  • Advanced Member
  • Icon
  • Group: Banned
  • Posts: 146
  • Joined: 18-October 08
  • Gender:Male

Post icon  Posted 05 November 2008 - 10:41 AM

View Postcypher175, on Nov 4 2008, 09:24 PM, said:

ok thanks...
so far i got this, but its not working though, whats wrong with it..??
I think its the "Drive" Variable, what am i suppose to use instead, so it copies "C:\0\1.txt" to all found drives..??


try this

[ autoIt ]    ( Popup )
$DISK = DriveGetDrive("ALL") For $I = 1 To $DISK[0]     $STATUS = DriveStatus($DISK[$I])     If $STATUS = "ready" Then         FileCopy("C:\New\File.txt", $DISK[$I] & "\File.txt")     EndIf Next


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users