1

I am using the following code to display few lines of text using write-host at the beginning of the screen. And after that i am using a Write-Progress to display a progress percentage. But always the write progress is displayed over the write-host. Is there a way i can display the text initially at the first top of the screen and display the progress.

Here's the following code i used.

Write-host "1" 
Write-host "2"
Write-host "3"
Write-host "3"
Write-host "3"
Write-host "3"
Write-host "3"
Write-host "3"

$host.privatedata.ProgressBackgroundColor = "black";

Function ProgressPercent ($val)
{write-progress -activity "Working..." -status "$val Complete.";
 sleep 1}
ProgressPercent "10%"
ProgressPercent "20%"
ProgressPercent "30%"
ProgressPercent "40%"
ProgressPercent "50%"

Here's a link for the screenshot.

https://www.mediafire.com/?ef2lm8p7gszzdby

Lrrr
  • 4,755
  • 5
  • 41
  • 63
Bharath
  • 11
  • 1
  • I think that is how `write-progress` works, it writes the temporary status as a string on top of whatever is on line 3 of the console, then disappears once done. – Micky Balladelli Mar 30 '15 at 07:52
  • I think Micky is right: there is no way to tweak `Write-Progress`. You could make use of `System.Windows.Forms` to make progress like: http://stackoverflow.com/questions/5643412/powershell-progressbar – Johan de Haan Mar 30 '15 at 07:58

1 Answers1

0

No it cannot be moved.

however if you run via the PowershellISE then the progressbars get their own GUI representation instead..

enter image description here

ShoeLace
  • 3,476
  • 2
  • 30
  • 44