2011-11-03 43 views
0

可能重复:
Getting the path of the home directory in C#?如何在.net中告诉用户“home”文件夹?

我知道的方法来发现像C:\Users\MyLogin\Desktop(Vista)或C:\Documents And Settings\MyLogin\Desktop(XP)文件夹。但是,如何在.net中获得C:\Users\MyLogin,即“用户主目录”?我正在寻找一种通用且安全的API调用,而不是“桌面向上一层”。

+0

康拉德你看到这个链接? http://stackoverflow.com/questions/1143706/getting-the-path-of-the-home-directory-in-c – Eric

回答

0

您需要使用这样的:

string userFolder = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); 
相关问题