开发者

How to programmatically write to the current prompt line in Powershell

开发者 https://www.devze.com 2022-12-18 21:53 出处:网络
Is it possible to send text to the current prompt line? Something like the following: PS[10]> Get-Location

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

精彩评论

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

关注公众号