在调查Environment.SpecialFolder
枚举时也很有帮助。使用LINQPad或创建解决方案并执行以下代码:
Enum.GetValues(typeof(Environment.SpecialFolder))
.Cast<Environment.SpecialFolder>()
.Select(specialFolder => new
{
Name = specialFolder.ToString(),
Path = Environment.GetFolderPath(specialFolder)
})
.OrderBy(item => item.Path.ToLower())
这是我的机器上的结果:
MyComputer
LocalizedResources
CommonOemLinks
ProgramFiles C:\Program Files (x86)
ProgramFilesX86 C:\Program Files (x86)
CommonProgramFiles C:\Program Files (x86)\Common Files
CommonProgramFilesX86 C:\Program Files (x86)\Common Files
CommonApplicationData C:\ProgramData
CommonStartMenu C:\ProgramData\Microsoft\Windows\Start Menu
CommonPrograms C:\ProgramData\Microsoft\Windows\Start Menu\Programs
CommonAdminTools C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools
CommonStartup C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
CommonTemplates C:\ProgramData\Microsoft\Windows\Templates
UserProfile C:\Users\fisch
LocalApplicationData C:\Users\fisch\AppData\Local
CDBurning C:\Users\fisch\AppData\Local\Microsoft\Windows\Burn\Burn
History C:\Users\fisch\AppData\Local\Microsoft\Windows\History
InternetCache C:\Users\fisch\AppData\Local\Microsoft\Windows\INetCache
Cookies C:\Users\fisch\AppData\Local\Microsoft\Windows\INetCookies
ApplicationData C:\Users\fisch\AppData\Roaming
NetworkShortcuts C:\Users\fisch\AppData\Roaming\Microsoft\Windows\Network Shortcuts
PrinterShortcuts C:\Users\fisch\AppData\Roaming\Microsoft\Windows\Printer Shortcuts
Recent C:\Users\fisch\AppData\Roaming\Microsoft\Windows\Recent
SendTo C:\Users\fisch\AppData\Roaming\Microsoft\Windows\SendTo
StartMenu C:\Users\fisch\AppData\Roaming\Microsoft\Windows\Start Menu
Programs C:\Users\fisch\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
AdminTools C:\Users\fisch\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools
Startup C:\Users\fisch\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Templates C:\Users\fisch\AppData\Roaming\Microsoft\Windows\Templates
Desktop C:\Users\fisch\Desktop
DesktopDirectory C:\Users\fisch\Desktop
Favorites C:\Users\fisch\Favorites
MyMusic C:\Users\fisch\Music
MyDocuments C:\Users\fisch\OneDrive\Documents
MyDocuments C:\Users\fisch\OneDrive\Documents
MyPictures C:\Users\fisch\OneDrive\Pictures
MyVideos C:\Users\fisch\Videos
CommonDesktopDirectory C:\Users\Public\Desktop
CommonDocuments C:\Users\Public\Documents
CommonMusic C:\Users\Public\Music
CommonPictures C:\Users\Public\Pictures
CommonVideos C:\Users\Public\Videos
Windows C:\Windows
Fonts C:\Windows\Fonts
Resources C:\Windows\resources
System C:\Windows\system32
SystemX86 C:\Windows\SysWoW64
(“ fisch”是我姓氏的前5个字母。这是使用Microsoft帐户登录时分配的用户名。)