亀の甲羅2

今日もまた朝とく起きて励まなん窓に明るきありあけの月

powershell メッセージボックスを表示する

一番単純なメッセージボックスは下記の通り。デフォルトでOKボタンは表示される。

Add-Type -AssemblyName System.Windows.Forms

[System.Windows.Forms.MessageBox]::Show("I Love you  so ...")

Showメソッドを調べれば、引数はほかにもある。

Add-Type -AssemblyName System.Windows.Forms

$Message = "I Love You So ...";
$title = "title"

$ButtonType = [System.Windows.MessageBoxButton]::OK
$MessageIcon = [System.Windows.MessageBoxImage]::Information

[System.Windows.MessageBox]::Show($Message, $Title, $ButtonType, $MessageIcon) | Out-Null