If you do not specify the folder explicitly, the system will search the process in the current working directory.
The current working directory (usually) starts as the exe directory of the application, but can be changed by viewing it using the Open or Save dialog box.
Using an explicit file path is the correct answer. The best way is to not rely on the working directory at all, but use the path to the file of the current executable file as a base.
Here are some ways to do this: Application.StartupPath , Application.ExecutablePath
The code might look something like this:
var exeName = "sample.exe"; var exePath = Path.Combine( Path.GetDirectoryName( Application.ExecutablePath ), exeName);
Bevan source share