2011-11-03 41 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); 
相關問題