I need to show the progress of , a bunch of running batch files in a specific sequence using a powershell script. Lets say there are 10 batch files:- 1.bat, 2.bat and so on upto 10.bat. The progress of the bar should increment when 1.bat is executed , then it should increment when 2.bat gets executed and progress bar should reach 100% when 10.bat gets executed.So far i have been able to create a progress bar using powershell. How to link the progress of those batch files with this progress bar? any pointers in this direction will be helpful. Thanks in advance.
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
# Init Form
$Form = New-Object System.Windows.Forms.Form
$Form.width = 1000
$Form.height = 200
$Form.Text = "**OSP Installation in Progress**"
# Init ProgressBar
$pbrTest = New-Object System.Windows.Forms.ProgressBar
$pbrTest.Maximum = 100
$pbrTest.Minimum = 0
$pbrTest.Location = new-object System.Drawing.Size(10,70)
$pbrTest.size = new-object System.Drawing.Size(967,10)
$i = 0
$Form.Controls.Add($pbrTest)
# Show Form
$Form.Add_Shown({$Form.Activate()})
$Form.ShowDialog()
OnLoad) and increment progress bar there withinforeachloop. OR (as a much better solution) not use a form and useWrite-Progressas suggested above.