开发者

How to programmatically write to the current prompt line in Powershell

Is it possible to send text to the current prompt line? Something like the following:

PS[10]> Get-Location
c:/
PS[11]> Write-PromptLine "This text has been written by Powershell"
PS[12]> This text has been written by Powershell|
# | denotes开发者_StackOverflow the caret


You could use the SendKeys.SendWait method:

[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[System.Windows.Forms.SendKeys]::SendWait("This text has been written by Powershell")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜