共用方式為


PSHost.Name Property

Definition

Gets the hosting application's identification in some user-friendly fashion. This name can be referenced by scripts and cmdlets to identify the host that is executing them. The format of the value is not defined, but a short, simple string is recommended.

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

Property Value

The name identifier of the hosting application.

Examples

if ($Host.Name -ieq "ConsoleHost") { write-host "I'm running in the Console Host" }

Remarks

In implementing this member, you should return some sort of informative string describing the nature your hosting application. For the default console host shipped by Microsoft this is ConsoleHost.

Applies to