Question: > 
> **Possible Duplicate:**  
> 
> [C# Executable Executing directory](https://stackoverflow.com/questions/7025269/c-sharp-executable-executing-directory) 
> 
> 
> 

I used 2010 Visual C# Express to write a little windows form .exe. How do I get the program to "know" what directory it's running from so that it can read/write from/to whichever directory the user has put my .exe in? Basically, I want my little .exe to be "portable", where it doesn't matter which folder/directory it's in, and yet it can "know" where all its files are.

Answer: 
You can use: 

[`Application.StartupPath`](http://msdn.microsoft.com/en-us/library/system.windows.forms.application.startuppath.aspx)
There are different approaches, but this worked for me.

```
string directory = AppDomain.CurrentDomain.BaseDirectory; 

```