How to Display a Progress Bar in PowerShell for a Silent Script?

0
15
Asked By CodingNinja77 On

I'm working with a PowerShell script that runs quietly in the background, and I'm looking to create a separate script that shows a visible progress bar. The goal is to inform users about which line the source script is currently processing. For instance, when the script reaches a line that says '* application closed', I want the progress bar to display 'application closed'. Ideally, I'd like this progress bar to appear in a single window that will close after processing a specific line. Does anyone have suggestions on how to implement this?

3 Answers

Answered By WizardOfPowershell On

How are you executing the second script? Understanding how you’re waiting for it to finish can help us figure out the best way to communicate between your scripts.

Answered By ScriptMaster99 On

You could try using Start-Transcript along with Write-Progress. Alternatively, create your own counter within your loop (like using for, foreach, or while) and utilize Write-Verbose to display messages.

Answered By TechyGuru29 On

Have you considered using the Write-Progress cmdlet? It’s a built-in way to show a progress bar in PowerShell. You can call it from within your silent script to display updates as the lines are processed.

CodingNinja77 -

I tried using Write-Progress, but it didn’t work because the main script is silent. I need a way to link it to a viable progress bar that shows each processed line.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.