powershellconsolepowershell-iseinput-history

How Do I Fetch Console Buffer History After a Clear-Host?


If I'm using the PowerShell ISE and I have a bunch of text on the screen from the previous commands I've run, I could then issue a 'Clear-Host' command to clean it up. The cursor goes to the top line of the screen, prints the prompt, and then waits again.

But once I do that I can't scroll up to see previous output anymore. Is that previous output saved anywhere? How can I look at the output of commands I've run before I did Clear-Host?

I have a script that does a Clear-Host, but I didn't actually intend to lose that old screen buffer history when I ran the script, so I'm hoping I can get it back somehow. I don't find it in the output of '$host |Export-Clixml file.xml', which was my first thought.


Solution

  • That feature is missing from Powershell ISE, at least up to, and including, version 3.0. Even Start-Transcript and Stop-Transcript will throw "This host does not support transcription."

    However, it looks like someone came up with a "Transcript" module to address this over here.

    Hopefully that will provide what you're looking for.