PowerShell C# Cmdlet 2
前回コマンドレットからの出力をやりましたので、今回はコマンドレットへの入力もおさえておきたいと思います。
using System;
using System.Management.Automation;
namespace InputTest
{
[Cmdlet(VerbsCommon.Get, "Para")]
public class GetGreeting : Cmdlet
{
[Parameter(ValueFromPipelineByPropertyName = true)]
public string BaseName { get; set; }
[Parameter(ValueFromPipelineByPropertyName = true)]
public string Extension { get; set; }
protected override void ProcessRecord()
{
Console.WriteLine(BaseName + " : " + Extension);
}
}
}
前回と環境は同じで、同様に実行させます。

lsはGet-ChildItemのエイリアスで、ディレクトリのファイルリストのオブジェクトを返します。
表示はされていませんが、オブジェクトに含まれています。
以下、念のため。
