Search the Community
Showing results for tags 'drivegetdrive'.
-
The DriveGetDrive command returned all drives (option "ALL") for years now and my program could always rely on that function. Suddenly a drive letter that was created with the subst command does not appear in the list of drives anymore. And it clearly did, because I used to react to a certain subst command by reacting to new or revoked (subst /D) drive letters. Why is that? I think this a bug because there's no way left to list ALL drive letters anymore. And why should I use an API command for that when this was already built in for years?
-
Hi, maybe is a silly question but i don't have understood how to make a list of internal HDD and external HDD-Pen Drive using DriveGetDrive FIXED = Internal HDDs, right? REMOVABLE = External HDDs - PenDrive, right? How to get both in the same list? Thanks
-
Hi Guys, For work i need to know how which drive letter are avaiable and take the first. For now i have make this script: Local $aArray = DriveGetDrive("ALL") Local $avArray[24] $avArray[0] = "A:\" $avArray[1] = "B:\" $avArray[2] = "C:\" $avArray[3] = "D:\" $avArray[4] = "E:\" $avArray[5] = "F:\" $avArray[6] = "G:\" $avArray[7] = "H:\" $avArray[8] = "I:\" $avArray[9] = "J:\" $avArray[10] = "K:\" $avArray[11] = "L:\" $avArray[12] = "M:\" $avArray[13] = "N:\" $avArray[14] = "O:\" $avArray[15] = "P:\" $avArray[16] = "Q:\" $avArray[17] = "R:\" $avArray[18] = "S:\" $avArray[19] = "T:\" $avArray[20] = "U:\" $avArray[21] = "V:\" $avArray[22] = "X:\" $avArray[23] = "Y:\" $avArray[24] = "Z:\" If @error Then ; An error occurred when retrieving the drives. MsgBox(4096, "DriveGetDrive", "It appears an error occurred.") Else For $i = 1 To $aArray[0] ; Show all the drives found and convert the drive letter to uppercase. ConsoleWrite(StringUpper($aArray[$i]) & "\" & @CRLF) Next EndIf Hope is a good approach. The result of DriveGetDrive is: C:\ D:\ W:\ X:\ Y:\ Z:\ So i want to compare mine letter with all avaible ( so the two array ), subtract from the complete list C-D-W-X-Y-Z and give me a new list, then take the fist drive avaiable ( in my case is E:\ = [1] ) Some suggestion? Thanks
-
I have a project I'm working on, as part of a maintenance disk. I want to make a GUI for automating chkdsk startup, as in I run the GUI, then I select what drives I'm wanting to chkdsk. I want to run this from a PE based enviroment, I believe the disk I've chosen is a BartPE based disk, if that matters. Here's where my issue comes into play. When I start the program I have it set to specify a log save location with a Save As box. That part works great, so I have it make the GUI. Here's the issue: When I'm making the GUI, I want it to grab the drive letters and use that as part of either Checkboxes OR multiple dropdown menus. That part I'm flexible on, I just want it to work, and the dropdown menus was just another way of thinking about it. So I figured out how to grab drive letters into an array and do an If-Then for less than 4 drives (test machine has 3 drives, trying to get it work before worrying about whether or not it's less than 2 or 3): Global $Drives[5] = ["1","2","3","4","5"] $Drives = DriveGetDrive("Fixed") If $Drives[0] < 4 Then $Drives[4] = "None" EndIf For some reason, when I run that code, it flips it's lid about being outside my subscript range. I added the ReDim command to resize it back to 5, but that still doesn't work. Now if I set it when I initialize it, it's fine, and I can edit it all I want to manually, just not with DriveGetDrive. Current modified code: Global $Drives[5] = ["1","2","3","4","5"] $Drives = DriveGetDrive("Fixed") If $Drives[0] < 4 Then ReDim $Drives[5] $Drives[4] = "None" EndIf What I would like to do is resize the Array to fix the amount of drives I have, i.e. if I have 2 drives, make it 3 slots big, [0] for the count it generates, [1] for drive 1, [2] for drive 2, etc. and if it doesn't get a reply from slots 3 and 4, disable those checkboxes/remove the entry from the dropdown list. But that is further complicating the issue as it is, just want the basic premise to work. If anyone has any ideas for this little issue, I'm welcoming the ideas.
-
Hey guys, I'm trying to use the delete files same time in Removable or change attrib to show. ex: delete : Autorun.inf ===> Attrib = SH in Removable this is try me : #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: GHOST SKIKDA Script Function: Hide Files System in Removable. #ce ---------------------------------------------------------------------------- #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiStatusBar.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 554, 454, 192, 114) GUISetBkColor(0x000000) $ListView1 = GUICtrlCreateListView("Name|Status", 16, 168, 522, 270, '', BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES)) _GUICtrlListView_SetExtendedListViewStyle(-1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 400) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetBkColor(-1, 0x800000) $ListView1context = GUICtrlCreateContextMenu($ListView1) $MenuItem1 = GUICtrlCreateMenuItem("Show", $ListView1context) $MenuItem2 = GUICtrlCreateMenuItem("Hide", $ListView1context) $MenuItem3 = GUICtrlCreateMenuItem("Delete", $ListView1context) $Button1 = GUICtrlCreateButton("Scan", 462, 134, 75, 25, $WS_GROUP) $Combo1 = GUICtrlCreateCombo("", 50, 136, 409, 25) $Label1 = GUICtrlCreateLabel("Path : ", 16, 139, 35, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) $StatusBar1 = _GUICtrlStatusBar_Create($Form1) Dim $StatusBar1_PartsWidth[1] = [-1] _GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth) _drivercombo() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _GUICtrlListView_DeleteAllItems($ListView1) Sleep(200) ;Search("f:\") _driver() Case $ListView1 EndSwitch WEnd ;~ Func _Search() ;~ $search = FileFindFirstFile("C:\*.*") ;~ If $search = -1 Then ;~ MsgBox(0, "Error", "No files/directories matched the search pattern") ;~ Exit ;~ EndIf ;~ $com=0 ;~ While 1 ;~ $file = FileFindNextFile($search) ;~ If @error Then ExitLoop ;~ $var = FileGetAttrib("C:\"&$file) ;~ If ($var = "RASH") or ($var = "SH") Then ;~ _GUICtrlListView_AddItem($ListView1, $file, $com) ;~ _GUICtrlListView_AddSubItem($ListView1, $com,$var, 1) ;~ ;_GUICtrlListView_SetItemChecked($ListView1, $com) ;~ $com=$com+1 ;~ EndIf ;~ WEnd ;~ FileClose($search) ;~ _GUICtrlStatusBar_SetText($StatusBar1, @TAB & "Resultat = " & _GUICtrlListView_GetItemCount($ListView1), 0) ;~ EndFunc Func Search($current) Local $search = FileFindFirstFile($current & "\*.*") $com=0 While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file) < 1 Then ExitLoop $var = FileGetAttrib($current &"\"&$file) If ($var = "RASH") or ($var = "SH") or ($var = "RAH") or ($var = "ASH") Then;StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") and _GUICtrlListView_AddItem($ListView1, $file, $com) _GUICtrlListView_AddSubItem($ListView1, $com,$var, 1) ;_GUICtrlListView_SetItemChecked($ListView1, $com) $com=$com+1 Search($current & "\" & $file) EndIf Sleep (1) _GUICtrlStatusBar_SetText($StatusBar1, @TAB & "Resultat = " & _GUICtrlListView_GetItemCount($ListView1), 0) WEnd EndFunc Func _driver() $drv = DriveGetDrive( "Removable") If NOT @error Then For $i = 2 to $drv[0] GUICtrlSetData($Combo1,$drv[$i]) Search($drv[$i]) Next EndIf EndFunc Func _drivercombo() $drv = DriveGetDrive( "Removable") If NOT @error Then For $i = 2 to $drv[0] GUICtrlSetData($Combo1,$drv[$i]) Next EndIf EndFunc