[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 572
  • Last Modified:

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

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
Ikelca
Asked:
Ikelca
  • 3
  • 2
1 Solution
 
dimajCommented:
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
 
IkelcaAuthor Commented:
i rather not to invoke any external windows programs...........
can this be done with c# only?
0
 
dimajCommented:
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
 
IkelcaAuthor Commented:
nvm, i found a way of doing it thru WMI
0
 
IkelcaAuthor Commented:
thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now