Web Design that taps into the haromny and vision of your dreams.

How to Obtain the Current Application Directory in C#

By on in Coding

38 words, estimated reading time 1 minutes.

From time to time you may need to access a file within the current application directory .Net provides a property that is set to the absolute path to the application executable, and a method can be used to extract the folder name.

using System.IO;
using System.Windows.Forms;
string appPath = Path.GetDirectoryName(Application.ExecutablePath);

Console Application project types will have to manually add a reference to the System.Windows.Forms assembly for the Application object to be exposed.

Last updated on: Friday 23rd June 2017



Have a question or suggestion? Please leave a comment to start the discussion.



Some other way to get current directory path.
1) Application.StartupPath
2) Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)

3) AppDomain.CurrentDomain.BaseDirectory

4) Path.GetDirectoryName( Environment.GetCommandLineArgs()[0])
5) System.IO.Directory.GetCurrentDirectory()
6) Environment.CurrentDirectory

For More information join

Reply to Suneel


There is no App.path in C#, that is current working Folder of project.

This is rediculous library provided by Microsoft.
Helll is well

Reply to HELLIC


Hey, thanks for the help! :) Finally was able to continue on coding!


Reply to Kyle


Hi! I was surfing and found your blog post... nice! I love your blog. :) Cheers! Sandra. R.

Reply to sandrar


Leave a Reply

Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Your email address will not be published.