Dil*_*ili 8 powershell command-line output
有没有办法在powershell中更新命令输出的当前行?
我知道怎么写到同一行:
Write-Host "hello " -NoNewLine
Write-Host "world!" -NoNewLine
但是有没有办法完成当前的线路更换?就像是:
Write-Host "hello "
Write-Host "world!" -ReplaceLine
Run Code Online (Sandbox Code Playgroud)
提前致谢!
解:
Write-Host "hello " -NoNewLine
Write-Host "`rworld!"
Run Code Online (Sandbox Code Playgroud)
Mat*_*sjo 14
使用回车返回到行的开头: `r
请参阅:http: //ss64.com/ps/syntax-esc.html
回车的定义:http: //en.wikipedia.org/wiki/Carriage_return
如果你想清除一条线,那就是一堆空格.否则你可以覆盖东西.
我不能在这里写一个例子,因为它是SO的代码字符,但是把它放在"world"字符串的开头,它应该可以工作.
希望这可以帮助!
| 归档时间: |
|
| 查看次数: |
15762 次 |
| 最近记录: |