June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to retrieve the path where the current executable is stored.
Read the shared StartupPath property of the System.Windows.Forms.Application class.
The System.Windows.Forms.Application class allows you to retrieve the directory where the executable is stored, even if it isn’t a Windows application.
Console.Write("Executable is: ")
Console.WriteLine(System.Windows.Forms.Application.ExecutablePath)
Console.Write("Executable is executing in: ")
Console.WriteLine(System.Windows.Forms.Application.StartupPath)In order to use this technique, you must reference the System. Windows.Forms namespace. Alternatively, you can simply find the current working path (using recipe Set the Current Working Path
Read now
Unlock full access