C# Get Current Directory of Executable

C# Get Current Directory of Executable

You may want to know the current directory of the executable from where you can start
setup of an application configuration by browsing the current directory of an application.


using System;
using System.IO;
namespace ConsoleApplication
class Program
static void Main(string[] args)
string path = Directory.GetCurrentDirectory();




Directory class found at System.IO namespace .net base class library.
It provides various static methods which can be used for Creating, moving of the directories and subdirectories.

Exceptions: Don’t forget to handle an exceptions while working with directory manipulation.
The application may don’t have privileges to brows the directory.


C# Create DirectoryC# Delete All Files In DirectoryDateTime in C# current Date and TimeC# Get File SizeC#.net Get Yesterday.C# Regular Expression Get Text Between BracketsC#.net get tomorrows dateJquery Get Target Of Event[Asp.net] Get current Page URL absolute URI and query string parameters.C#-move files from foldersC# Get Random Item From List (VB.net) Example.


My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.

I'm Satalaj.