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")
精彩评论