Monday, May 09, 2005

 

Display Special Environment folders

Display Environment folders
// Display special folders of the computer
using System;

public class GetSpecialFolder
{
public static void Main()
{
Console.WriteLine("Display environment folders of this computer");


Console.WriteLine("Application Data = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
Console.WriteLine("CommonApplicationData = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData));
Console.WriteLine("CommonProgramFiles = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles));
Console.WriteLine("Cookies = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.Cookies));
Console.WriteLine("Desktop = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
Console.WriteLine("DesktopDirectory = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory));
Console.WriteLine("Favorites = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.Favorites));
Console.WriteLine("History = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.History));
Console.WriteLine("InternetCache = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.InternetCache));
Console.WriteLine("LocalApplicationData = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));
Console.WriteLine("MyComputer = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.MyComputer));
Console.WriteLine("MyMusic = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.MyMusic));
Console.WriteLine("MyPictures = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.MyPictures));
Console.WriteLine("Personal = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.Personal));
Console.WriteLine("ProgramFiles = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
Console.WriteLine("Programs = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.Programs));
Console.WriteLine("Recent = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.Recent));
Console.WriteLine("SendTo = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.SendTo));
Console.WriteLine("StartMenu = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.StartMenu));
Console.WriteLine("Startup = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.Startup));
Console.WriteLine("System = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.System));
Console.WriteLine("Templates = \"{0}\"",
Environment.GetFolderPath(Environment.SpecialFolder.Templates));
}
}
The "My Documents" folder is found at Environment.GetFolderPath(Environment.SpecialFolder.Personal) This method will return a string to the path of "My Documents".
Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?