カレンダーを表示する

カレンダーを表示するスクリプトを作成しました。

$ca +="`n"
$today = get-Date;
$header = "*" + [string]$today.Year + "." + [string]$today.Month + "`n";
$ca += $header;
$ca += "Su  Mo  Tu  We  Th  Fr  Sa  `n";
$date = Get-Date -Day 1;
switch ($date.DayOfWeek){
    "Sunday"    {break};
    "Monday"    {$ca += (' ' * 4) * 1; break};
    "Tuesday"   {$ca += (' ' * 4) * 2; break};
    "Wednesday" {$ca += (' ' * 4) * 3; break};
    "Thursday"  {$ca += (' ' * 4) * 4; break};
    "Friday"    {$ca += (' ' * 4) * 5; break};
    "Saturday"  {$ca += (' ' * 4) * 6; break};
}
$this_month = $today.Month;
while ($date.Month -eq $this_month) {
    $ca += ("{0:00}" -f $date.Day);
    if ($date.Day -eq $today.Day){
      $ca += "* ";
    }else{
      $ca += " "*2;
    }
    if ($date.DayOfWeek -eq "Saturday") {$ca += "`n"};
    $date = $date.AddDays(1);
}
$ca += "`n";
$ca;



以下が実行結果です。