December 07, 2020

C# get windows user app data folder path

 Hi folks,

Today I will explain to get the folder path of the windows user specific app data for storing any program (app) based information in C# (.NET Framework, .NET CORE, .NET 5)


Source

using System;

using System.IO;

namespace NETFrameworkConsoleApp1

{

    class Program

    {

        static void Main(string[] args)

        {

            string dir = Path.Combine(

                Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),

                "FolderName"

            );

            Console.WriteLine("User Appdata Path: \n " + dir);

            Console.ReadLine();

        }

    }

}


Hope this helps you to customize your requirement.

References

https://docs.microsoft.com/en-us/dotnet/api/system.environment?view=net-5.0

Please share your comments and feedback to psrdotcom@gmail.com


No comments:

Featured Post

Java Introdcution

Please send your review and feedback to psrdotcom@gmail.com