标题: [转载代码] PowerShell窗口动态显示当前系统时间 [打印本页]
作者: PS2.0 时间: 2017-7-31 10:35 标题: PowerShell窗口动态显示当前系统时间
- $code =
- {
- # submit the host process RawUI interface and the execution context
- param($RawUi)
-
- do
- {
- # compose the time and date display
- $time = Get-Date -UFormat "%Y-%m-%d %H:%M:%S"
- # compose the title bar text
- $title = "Current Time: $time"
- # output the information to the title bar of the host process
- $RawUI.WindowTitle = $title
- # wait a half second
- Start-Sleep -Milliseconds 500
- } while ($true)
- }
- $ps = [PowerShell]::Create()
- $null = $ps.AddScript($code).AddArgument($host.UI.RawUI)
- $handle = $ps.BeginInvoke()
复制代码
http://community.idera.com/powershell/powertips/b/tips/posts/adding-live-clock-to-powershell-title-bar-part-1
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |