If you want to get the path to the special of the user like My Documents etc. , you can use the Environment.GetFolder with the enum “Environment.SpecialFolder”.

How to Get the Path to special folder using C# ?

Below is a sample code snippet demonstrating on how to do it.

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.IO;
namespace AbundantcodeConsoleApp
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            foreach (var specialFolder in Enum.GetValues(typeof(Environment.SpecialFolder)))
            {
                string FolderPath = Environment.GetFolderPath((Environment.SpecialFolder)specialFolder);
                Console.WriteLine(FolderPath);
            }
           Console.ReadLine();
        }     
    }
    
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Liked this content?. Please spread the word :)

  • RSS
  • Twitter
    Visit Us
    Follow Me