I'm writing a script to backup our SVN repositories, based on http://www.codeproject.com/KB/powershell/SVNBackupPower.aspx. It works sweet, but when it's waiting for the ZIP to complete, I'd like it to issue a dot instead of a new line each iteration. So,

Waiting for ZIP ...................

as opposed to

Waiting for ZIP
Waiting for ZIP
Waiting for ZIP
Waiting for ZIP
(you get the picture)

I guess the equivalent in BASIC from back in the day would be:

PRINT ".";

But what's the PowerShell equivalent?

link|improve this question
feedback

2 Answers

Pretty simple...

write-host "Waiting for zip" -nonewline
while ($inloop -eq true) {
    write-host "." -nonewline
    $inloop=Get-LoopStatus($Thingy)
}
write-host "."

The key is -nonewline. You can even make those additional bits different colors via -foregroundcolor.

link|improve this answer
Perfect. Thank you. I knew it would be, unfortunately, a little more difficult to search for. Have been trawling through all sorts of complicated formatting options. – Program.X Dec 16 '11 at 15:42
feedback

You could also use the write-progress cmdlet to visualize a progress bar.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.