Tuesday, January 4, 2011

Setting the current working directory to the current application

Here's how you can set the current working directory to the currently executing application in .NET:


Directory.SetCurrentDirectory(GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));



And you can get the current working directory from Directory.GetCurrentDirectory