Search the Community
Showing results for tags 'removable'.
-
I had problem differentiating drives of system and External drives as they're both of same type - "FIXED" when using DriveGetDrive and DriveGetType, so managed to make a small script to detect External ones. Im a newb, so you may will find silly, unnecessary code which could have been done better with smart work instead of hard work, if you know what i mean #include <Array.au3> Local $drivelist = DriveGetDrive("FIXED"), $addspace = 0, $getspace, $systemdrives, $externaldrives ;~ _ArrayDisplay($drivelist) findexthdd() Func findexthdd() RunWait(@ComSpec & " /c " & 'wmic diskdrive get PNPDeviceID, size /format:csv | find /v "USBSTOR" > wmic.txt', @ScriptDir, @SW_HIDE) $file = FileOpen("wmic.txt") $readfile = FileRead($file) $readfile = StringSplit($readfile, ",") ;~ _ArrayDisplay($readfile) $last = $readfile[0] $totalsize = $readfile[$last] $totalsize = $totalsize / 1024 / 1024 / 1024 ;MB Do Local $c = 1 $totalsize = StringTrimRight($totalsize, $c) $c = $c + 1 $return = StringInStr($totalsize, ".") Until $return = 0 $return = 1 For $w = 1 To UBound($drivelist) - 1 $getspace = DriveSpaceTotal($drivelist[$w]) / 1024 Do Local $z = 1 $getspace = StringTrimRight($getspace, $z) $z = $z + 1 $return = StringInStr($getspace, ".") Until $return = 0 $addspace += $getspace If $addspace <= $totalsize Then ;463 vs 465 $systemdrives &= $drivelist[$w] & "," Else ;~ MsgBox(0, "", $drivelist[$w] & " is the f****** external hard drive!") $externaldrives &= $drivelist[$w] & "," EndIf Next $systemdrives = StringTrimRight($systemdrives, 1) $systemdrives = StringSplit($systemdrives, ",") _ArrayDisplay($systemdrives, "SYSTEM DRIVES LIST") $externaldrives = StringTrimRight($externaldrives, 1) $externaldrives = StringSplit($externaldrives, ",") _ArrayDisplay($externaldrives, "EXTERNAL DRIVES LIST") EndFunc ;==>findexthdd
- 12 replies
-
- External hard drives
- Fixed
-
(and 5 more)
Tagged with:
-
Hi, I'm trying to develope a program to safely eject an USB device. I have tried a lot of way but there was no satisfactory result. I used to consult wraithdu's script here : but that script wasn't work on my Win7 machine, then I heard someone talk about Devcon, then I started to explore it, I have scripted, tested for days and get nothing but errors. I used this command : devcon remove @usb\* to remove all removable devices but here the result goes : All failed? I have just plugged on two USB Kingmax and Transcend! I need some professional guys to solve the problem:D Thanks!