piro Posted June 30, 2008 Share Posted June 30, 2008 Is there any easy way to fetch all the network drives and their paths in such a way that I can store them and use DriveMapAdd to add them back later? At the moment I'm just using DriveMapGet for specific drives that I know will exist, then writing the info to an ini file - this is fine, but I don't want to write a DriveMapGet for every case - it'd be nice if I could get it do it with less messy code. Thanks! Link to comment Share on other sites More sharing options...
Monamo Posted June 30, 2008 Share Posted June 30, 2008 Is there any easy way to fetch all the network drives and their paths in such a way that I can store them and use DriveMapAdd to add them back later?At the moment I'm just using DriveMapGet for specific drives that I know will exist, then writing the info to an ini file - this is fine, but I don't want to write a DriveMapGet for every case - it'd be nice if I could get it do it with less messy code.Thanks!Yep, try a combination of DriveGetDrive() and DriveMapGet() - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
weaponx Posted June 30, 2008 Share Posted June 30, 2008 Dim $objWMIService = ObjGet("winmgmts:\\.\root\cimv2") Dim $colDrives = $objWMIService.ExecQuery ("Select * From Win32_LogicalDisk Where DriveType = 4") For $objDrive in $colDrives ConsoleWrite("Drive letter: " & $objDrive.DeviceID & @CRLF) ConsoleWrite("Network path: " & $objDrive.ProviderName & @CRLF) Next Link to comment Share on other sites More sharing options...
piro Posted June 30, 2008 Author Share Posted June 30, 2008 Dim $objWMIService = ObjGet("winmgmts:\\.\root\cimv2") Dim $colDrives = $objWMIService.ExecQuery ("Select * From Win32_LogicalDisk Where DriveType = 4") For $objDrive in $colDrives ConsoleWrite("Drive letter: " & $objDrive.DeviceID & @CRLF) ConsoleWrite("Network path: " & $objDrive.ProviderName & @CRLF) NextoÝ÷ Ûú®¢×+"±ö§µ«-Âjw²)r²°¶¨ºÚn¶)í¡©â'âæ¬#§µ»mè§ëÞ®Ø^ب¶0Â¥tazzÞiÛazG²±úèØ^xWiÉ"Ú/j¸nW¬~ÀºÚNÚ-éæjayÚâ½ë ÷§¶¬²X Ö¥µêÚ¶*'jëh×6Dim $objWMIService = ObjGet("winmgmts:\\.\root\cimv2") Dim $colDrives = $objWMIService.ExecQuery ("Select * From Win32_LogicalDisk Where DriveType = 4") For $objDrive in $colDrives IniWrite("C:\test.ini","Drives",""&$objDrive.DeviceID&"",""&$objDrive.ProviderName&"") Next Apologies if it sounds silly, I've been fudging my way through AutoIT for years, but I want to do things better as opposed to just fudging them. Thanks! Link to comment Share on other sites More sharing options...
weaponx Posted June 30, 2008 Share Posted June 30, 2008 $array = IniReadSection("test.ini", "drives") For $X = 1 to $array[0][0] ConsoleWrite("Key: " & $array[$X][0] & " Value: " & $array[$X][1] & @CRLF) Next Link to comment Share on other sites More sharing options...
piro Posted June 30, 2008 Author Share Posted June 30, 2008 (edited) $array = IniReadSection("test.ini", "drives") For $X = 1 to $array[0][0] ConsoleWrite("Key: " & $array[$X][0] & " Value: " & $array[$X][1] & @CRLF) Next Yeah, this is perfect. Thank you ever so much good sir! Edited June 30, 2008 by piro Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now