Solved

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

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

820 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