コマンドレットのヘルプ トピックに入力の種類を追加する方法

このセクションでは、PowerShell コマンドレットのヘルプ トピックに INPUTS セクションを追加する方法について説明します。 [ 入力 ] セクションには、コマンドレットがパイプラインからの入力として受け取るオブジェクトの .NET クラスを値またはプロパティ名で一覧表示します。

INPUTS セクションに追加できるクラスの数に制限はありません。 入力型はノードで囲み、各クラスは <command:inputTypes> 要素で囲 <command:inputType> まれたものになります。

スキーマには、各要素に <maml:description> 2 つの要素が <command:inputType> 含まれています。 ただし、 コマンドレット Get-Help では、 要素の内容だけが表示 <command:inputType>/<maml:description> されます。

PowerShell 3.0 から、コマンドレット Get-Help によって 要素の内容が表示 <maml:uri> されます。 この要素を使用すると、.NET クラスを記述するトピックにユーザーを指示できます。

次の XML は、 ノードを示 <maml:inputTypes> しています。

<command:inputTypes>
  <command:inputType>
    <dev:type>
      <maml:name> Class name </maml:name>
      <maml:uri>  URI of a topic that describes the class </maml:uri>
      <maml:description/>
    </dev:type>
    <maml:description>
      <maml:para> Brief description </maml:para>
    </maml:description>
  </command:inputType>
</command:inputTypes>

次の XML は、 ノードを使用して入力型 <maml:inputTypes> を文書化する例を示しています。

<command:inputTypes>
  <command:inputType>
    <dev:type>
      <maml:name>System.DateTime</maml:name>
      <maml:uri>https://docs.microsoft.com/dotnet/api/system.datetime</maml:uri>
      <maml:description/>
    </dev:type>
    <maml:description>
      <maml:para> You can pipe a date to the Set-Date cmdlet. <maml:para>
    <maml:description>
  </command:inputType>
</command:inputTypes>