C # Window Directory

How do I find the section where windows are installed using java or c #? so the access to the files will be dynamic on different computers, i.e. it will refer to C: of D: where windows are installed

+3


source to share


4 answers


Try this in C #. This will help you get the Windows directory.



String Text= Environment.GetEnvironmentVariable("windir");

      

+5


source


It should be Path.GetPathRoot(Environment.SystemDirectory)

in C #.



+2


source


You can use a SystemDirectory

class property System.Environment

in C #.

+1


source


For C # to be Path.GetPathRoot(Environment.SystemDirectory)

, this will give you the root path like "C: \"

+1


source







All Articles