Process.ProcessName 属性

定义

获取该进程的名称。Gets the name of the process.

public:
 property System::String ^ ProcessName { System::String ^ get(); };
public string ProcessName { get; }
member this.ProcessName : string
Public ReadOnly Property ProcessName As String

属性值

String

系统用以向用户标识该进程的名称。The name that the system uses to identify the process to the user.

例外

进程没有标识符,或者没有与 Process 关联的进程。The process does not have an identifier, or no process is associated with the Process.

-or- 关联进程已退出。The associated process has exited.

进程不在此计算机上。The process is not on this computer.

注解

ProcessName属性保留可执行文件名(如 Outlook),该名称不包括 .exe 扩展名或路径。The ProcessName property holds an executable file name, such as Outlook, that does not include the .exe extension or the path. 它有助于获取和操作与同一可执行文件关联的所有进程。It is helpful for getting and manipulating all the processes that are associated with the same executable file.

备注

在 Windows 2000 操作系统上, ProcessName 如果无法获取进程模块信息,属性可能会被截断为15个字符。On Windows 2000 operating systems, the ProcessName property may be truncated to 15 characters if the process module information cannot be obtained.

您可以调用 GetProcessesByName ,并向其传递可执行文件的名称,以检索包含指定计算机上每个正在运行的实例的数组。You can call GetProcessesByName, passing it an executable file name, to retrieve an array that contains every running instance on the specified computer. 例如,你可以使用此数组关闭可执行文件的所有正在运行的实例。You can use this array, for example, to shut down all the running instances of the executable file.

适用于

另请参阅