|
-
Dec 17th, 2003, 04:24 PM
#1
Thread Starter
yay gay
how to get all the drives in a computer?
how do i do that? do i have to use api for it?
\m/  \m/
-
Dec 17th, 2003, 04:36 PM
#2
I wonder how many charact
I believe you can use the System.Management.ManageMentClass to retrieve that information.
I remember seeing an excerpt on MSDN where it retrieved all drives using 3 lines of code, something akin to below:
Code:
using System;
using System.Management;
// Disktypes - NoRoot = 1; Removable = 2; LocalDisk = 3; Network = 4; CD = 5; RAMDrive = 6;
public class Wmis {
public static void Main() {
ManagementClass disks = new ManagementClass("Win32_LogicalDisk");
ManagementObjectCollection moc = disks.GetInstances();
foreach(ManagementObject mo in moc)
{
Console.WriteLine("Disk type\t{0}", mo["DriveType"].ToString());
mo.Dispose();
}
disks.Dispose();
}
}
-
Dec 17th, 2003, 04:38 PM
#3
Thread Starter
yay gay
ty all try it when i get home
\m/  \m/
-
Dec 17th, 2003, 05:13 PM
#4
VB Code:
Dim strDrives As String() = Environment.GetLogicalDrives()
Dim drive As String
For Each drive In strDrives
Console.WriteLine(drive)
Next
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Dec 19th, 2003, 02:01 PM
#5
Addicted Member
dynamic_sysop, you're like an encyclopedia of useful stuff. Thanks for contributing so generously in the forums.
-
Dec 19th, 2003, 02:02 PM
#6
Addicted Member
And you too Nemaroller
-
Dec 19th, 2003, 11:35 PM
#7
I wonder how many charact
Oh, if you ever want to see some funny stuff, just do a search by username, and click to the last page of the search result.
-
Dec 20th, 2003, 04:22 AM
#8
Frenzied Member
Originally posted by GSIV
dynamic_sysop, you're like an encyclopedia of useful stuff. Thanks for contributing so generously in the forums.
no kidding. He has the best answers!! Where do you get your info from? I look at the msdn and can't decrypt it for crap!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|