I have successfully incorporated Write-Progress into my scripts. When my scripts get to any portion where RoboCopy is used Write-Progress disappears and reappears when RoboCopy is complete:
Write-Progress -Id 1 -Activity $arg2 -PercentComplete $i -Status $arg1
RoboCopy C:\source C:\destination /MIR
I have considered using Start-Process to run Write-Progress but have had limited success. Any help would be gladly appreciated.
I was able to answer my own question. Here is the solution by using
Start-Job:So let me explain.
Start-Jobcreates a background job and redirects it’s own output to the bit-bucket. Since it’s a background job, I’m immediately returned to run more stuff, like cat which spills all the contents of RoboCopy’s log file. In the end, it works as it should to begin with. YAY!