Check whether drive is main drive

97 Views Asked by At

I've got a DriveInfo object. I want to find out whether the drive is the Windows Drive(on my PC it's C:) because you can't right to the root directory of the Windows Drive.

1

There are 1 best solutions below

1
BendEg On BEST ANSWER

You could use string path = Path.GetPathRoot(Environment.SystemDirectory); and than check agains the drive name, like C:\ or D:\, ...