Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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.

share|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

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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