c # various acquisition methods path

// Get the base directory of the program.
System.AppDomain.CurrentDomain.BaseDirectory

// get the full path to the module, including the file name
System.Diagnostics.Process.GetCurrentProcess (). MainModule.FileName

// get and set the current directory (the directory from which you started the process) fully qualified directory.
System.Environment.CurrentDirectory

// Get the application's current working directory, pay attention to the working directory can be changed, but not limited to the program directory.
System.IO.Directory.GetCurrentDirectory ()

// get and set names include directory of the application.
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase

// Get the path for the executable file of the application.
System.Windows.Forms.Application.StartupPath

// Get started the application's executable file path and file name
System.Windows.Forms.Application.ExecutablePath

Published 43 original articles · won praise 8 · views 3914

Guess you like

Origin blog.csdn.net/MaYang_/article/details/103964212