こんにちは。
Windows10のPowershellで、以下の進捗状況を表すプログレスバーを作成しました。
Start-job でこのfunctionを実行すると、ちゃんとバーが表示されるのですが、その後
Write-Output "処理完了" の作業が終わったら、このバーを消すようにしたいと思っています。
Stop-job、Remove-jobなど自分なりに色々試したのですが、私自身まだ初心者なので今一つ
やり方が分からず、どうしても消えてくれません。
こちらのバーの消し方をぜひ教えて頂ければと思います。宜しくお願い致します。
function goForm
{
[void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms")
[System.Windows.Forms.Application]::EnableVisualStyles();
Add-Type -AssemblyName System.Windows.Forms
$Form = New-Object System.Windows.Forms.Form
$Form.Size = "156,92"
$Form.Startposition = "CenterScreen"
$Form.Text = "処理中です..."
$Form.MaximizeBox=$False
$Form.MinimizeBox=$False
$Form.FormBorderStyle="Fixed3D"
$Form.TopMost=$True
$Bar = New-Object System.Windows.Forms.ProgressBar
$Bar.Location = "10,10"
$Bar.Size = "115,30"
$Bar.Maximum = "100"
$Bar.Minimum = "0"
$Bar.Style = "Marquee"
$Start = {
For ( $i = 0 ; $i -lt 1000 ; $i++ )
{
$Bar.Value = $i+1
start-sleep -s 1
}
}
$Form.Controls.AddRange(@($Bar,$Button))
$Form.ShowDialog()
}
Start-job $function:goForm
Write-Output "処理完了"

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/11/14 02:17