Find OS installed partition

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I am developing a dll in C#. This has to find the root directory(partition) in which the currently running Operating System is installed. Is there a way to do it and how
Thanks in advance
Arr S
 
You can find out the system directory of the current OS by the property

Environment.SystemDirectory

This will give you someting like "E:\Windows\System32".

or read an environemnt variable called "SystemRoot" which will give you
"E:\Windows"

if you are interested only in the drive(partition) in which the current
os is installed Then read an environment variable called SystemDrive
which will give you "E:"

hope this helps.

regards,
Abhishek.
 
Back
Top