Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Obtaining path of users directory

How to get path of Users folder from windows service on MS Vista? I think about path of C:\Users directory, but it may be different location depend on system localization.

like image 433
user1013552 Avatar asked Jan 06 '12 21:01

user1013552


1 Answers

Take a look at the Environment.SpecialFolder Enumeration, e.g.

 Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory);

Adjust for the special folder you want. However, in reading another post found here, it looks like you may need to do a little manipulation of the string if you want exactly c:\users instead of c:\users\public, for example.

like image 150
George Johnston Avatar answered Sep 28 '22 00:09

George Johnston