Tim Van Wassenhove

Passionate geek, interested in Technology. Proud father of two

02 May 2010

Enumerating SpecialFolders

Environment.SpecialFolder is a value-type that i always seem to forget about. Let’s try to do something about that by posting about it here :)

foreach (var name in Enum.GetNames(typeof(Environment.SpecialFolder)))
{
	var specialFolder = (Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), name);
	Console.WriteLine("{0,25} => {1}", name, Environment.GetFolderPath(specialFolder));
}
<td>
  C:\Users\timvw\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
</td>
<td>
  C:\Users\timvw\Documents
</td>
<td>
  C:\Users\timvw\Documents
</td>
<td>
  C:\Users\timvw\Favorites
</td>
<td>
  C:\Users\timvw\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
</td>
<td>
  C:\Users\timvw\AppData\Roaming\Microsoft\Windows\Recent
</td>
<td>
  C:\Users\timvw\AppData\Roaming\Microsoft\Windows\SendTo
</td>
<td>
  C:\Users\timvw\AppData\Roaming\Microsoft\Windows\Start Menu
</td>
<td>
  C:\Users\timvw\Music
</td>
<td>
  C:\Users\timvw\Desktop
</td>
<td>
</td>
<td>
  C:\Users\timvw\AppData\Roaming\Microsoft\Windows\Templates
</td>
<td>
  C:\Users\timvw\AppData\Roaming
</td>
<td>
  C:\Users\timvw\AppData\Local
</td>
<td>
  C:\Users\timvw\AppData\Local\Microsoft\Windows\Temporary Internet Files
</td>
<td>
  C:\Users\timvw\AppData\Roaming\Microsoft\Windows\Cookies
</td>
<td>
  C:\Users\timvw\AppData\Local\Microsoft\Windows\History
</td>
<td>
  C:\ProgramData
</td>
<td>
  C:\Windows\system32
</td>
<td>
  C:\Program Files
</td>
<td>
  C:\Users\timvw\Pictures
</td>
<td>
  C:\Program Files\Common Files
</td>