ウィンドウのタイトルを変更できます。これはヘッダーのように機能しますが、探しているものが正確に得られるかどうかはわかりません。
$Host.UI.RawUI.WindowTitle = "Your Custom Header"
Write-Progress コマンドレットを使用するというジャンボの提案は、純粋な PowerShell でフッターが表示される限り、おそらくほぼ同じくらい良いものです。
もう 1 つのオプションは、適切なヘッダー/フッターを提供する WinForms/WPF アプリで PowerShell ランタイムをホストすることです。非常に単純で不自然な例では、次のようなことを C# で行います。
// include the System.Management.Automation assembly & namespace
PowerShell ps = PowerShell.Create();
ps.AddCommand("Get-Process");
foreach (PSObject result in ps.Invoke()) {
Console.WriteLine(result.Members["ProcessName"].Value);
}
コンソールに書き込む代わりに、おそらく出力を TextBox またはより適切なものにダンプします。
最後のオプションは、コンソールがCursorPositionプロパティを設定する機能を使用することです。スクロールする出力を上書きすることになるため、これは一種のハックですが、スクリプトの出力が制限されている場合は、次のように機能する可能性があります。
$pos = $Host.UI.RawUI.CursorPosition
$newPos = New-Object System.Management.Automation.Host.Coordinates 0,20
$Host.UI.RawUI.CursorPosition = $newPos
"Here is my footer on starting at the first character of line 20"
$Host.UI.RawUI.CursorPosition = $pos
プロパティを動的に調べて$Host.UI.RawUI.WindowSize.Height
、フッターをウィンドウの下部近くに設定できます。出力が多い場合、デフォルトではテキストがスクロールすることを覚えておいてください。これには、画面を上にスクロールする古いバージョンのフッターも含まれます。