我正在编写一个脚本来备份我们的 SVN 存储库,基于http://www.codeproject.com/KB/powershell/SVNBackupPower.aspx。它工作得很好,但是当它等待 ZIP 完成时,我希望它在每次迭代时发出一个点而不是一个新行。所以,
Waiting for ZIP ...................
Run Code Online (Sandbox Code Playgroud)
与
Waiting for ZIP
Waiting for ZIP
Waiting for ZIP
Waiting for ZIP
(you get the picture)
Run Code Online (Sandbox Code Playgroud)
我猜当时 BASIC 中的等价物是:
PRINT ".";
Run Code Online (Sandbox Code Playgroud)
但是 PowerShell 等价物是什么?
很简单...
write-host "Waiting for zip" -nonewline
while ($inloop -eq true) {
write-host "." -nonewline
$inloop=Get-LoopStatus($Thingy)
}
write-host "."
Run Code Online (Sandbox Code Playgroud)
关键是-nonewline
。您甚至可以通过-foregroundcolor
.
归档时间: |
|
查看次数: |
16968 次 |
最近记录: |