Get the application's own path

xiaoxiao2021-03-05  32

Application.Startuppath - Get the path to start the executable of the application, does not include the name of the executable. Environment.currentDirectory - Gets and sets the fully qualified path of the current directory (that is, the directory that is started from the process). Application.executablePath - Get the path to start the executable of the application, including the name of the executable.

// You can get the file name of the currently executed EXE. TextBox1.text = process.getCurrentProcess (). Mainmodule.FileName; // Net, get the fully qualified path of the current directory (that is, the directory that is started from the process). TEXTBOX2.TEXT = Environment; // According to the definition, if the process starts in the root directory of the local or network drive, the value of this property is the drive name and follows a tail backslash (such as "C: /"). If the process starts in a subdirectory, the value of this property is a driver and subdirectory path without a tail backslash (such as "C: / MySubdirectory"). TextBox3.text = Directory.getCurrentDirectory (); // Get the base directory, which is used by the assembly conflict resolution to detect the assembly. TextBox4.text = Appdomain.currentDomain.baSedirectory; // Get the path to start the application's executable, does not include the name of the executable. TextBox5.text = Application.Startuppath; // Get the path to activate the executable of the application, including the name of the executable. TextBox6.text = Application.executablePath; // Gets or sets the name of the directory containing the application. TextBox7.text = Appdomain.currentDomain.setupinformation.ApplicationBase;

转载请注明原文地址:https://www.9cbs.com/read-34029.html

New Post(0)