Link to home
Start Free TrialLog in
Avatar of Ikelca
IkelcaFlag for Canada

asked on

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# ?
Avatar of dimaj
dimaj
Flag of United States of America image

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.
Avatar of Ikelca

ASKER

i rather not to invoke any external windows programs...........
can this be done with c# only?
ASKER CERTIFIED SOLUTION
Avatar of dimaj
dimaj
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ikelca

ASKER

nvm, i found a way of doing it thru WMI
Avatar of Ikelca

ASKER

thanks