This solution is through .NET but I havn't tried it yet:
path = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly(). GetName().CodeBase );
Or
string path = Path.GetDirectoryName(
Assembly.GetAssembly(typeof(MyClass)).CodeBase);
Or
string executableName = Application.ExecutablePath;
FileInfo executableFileInfo = new FileInfo(executableName);
string executableDirectoryName = executableFileInfo.DirectoryName;
Comment