Solved

how to list drive type in c# when there is no drive letter??

Posted on 2011-03-08
5
548 Views
Last Modified: 2013-12-17
just same as title says, i'm trying to create a little program that can assign drive letter to removable drive that has no drive letter assigned by system automatically.
it is mainly under windows.

i have got most of part, but i could not find a way to test if a usb removable drive has drive letter or not.
how can I do this in c# ?
0
Comment
Question by:Ikelca
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:dimaj
ID: 35077884
check out a command called 'fsutil'
It's a windows command that contains a lot of information about windows internals. You can invoke this command from within your C# code by spawning a new process and capturing its output. If you can't capture the output, have the command pipe its results to a text file and then read the text file for your results.

Hope this'll get you started.
0
 

Author Comment

by:Ikelca
ID: 35078251
i rather not to invoke any external windows programs...........
can this be done with c# only?
0
 
LVL 7

Accepted Solution

by:
dimaj earned 500 total points
ID: 35078331
I briefly scanned through these links and they might have bits and pieces that will help you with your problem:
http://stackoverflow.com/questions/271907/how-to-detect-using-c-if-a-pendrive-is-plugged-into-a-usb-port
http://www.codeproject.com/KB/system/DriveDetector.aspx
0
 

Author Comment

by:Ikelca
ID: 35079959
nvm, i found a way of doing it thru WMI
0
 

Author Comment

by:Ikelca
ID: 35079961
thanks
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now