Solved

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

Posted on 2011-03-08
5
550 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Icons and Colors for Terms 3 24
asp.net mvc input file 2 32
Runtime Error 2 27
C# Json POSt to Rest API 4 32
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

929 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

15 Experts available now in Live!

Get 1:1 Help Now