I have a windows forms project. In the current directory I have a Help folder with *.chm files. What is the easiest way to launch them from the application? How can I specif
I can think of two options, depending on what you actually want. The first is to get the path to the resident directory (where the executing files live) and the second concerns the current directory (the directory specified for the executable to work from):
Resident directory:
var path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
Current directory:
var path = System.Environment.CurrentDirectory;
There is also another option, which, according to documentation gets the path for the executable file that started the application, not including the executable name
:
var path = Application.StartupPath;
As for constructing your path, other answers cover that very well indeed.