How to lock Powershell ISE console output scroll?

6

I'm using Powershell ISE for running some batch scripts. The outputs will be long and these programs will run for quite a some time. The problem I'm facing is I'm unable to lock the console output to any position to be able to read some errors that are displayed? Is there anyway to lock the scroll even when new output is being appended at the end of the console output?

Buddha

Posted 2013-11-05T11:26:11.417

Reputation: 465

Answers

2

From what I gather ISE does not support pausing the output. you can stop it with Ctrl+c but can not resume it. Instead what may be useful for you. You can send the console output to a file for perusing. I found two codes depending on the version of ISE you are using. I believe you change "Test" to what you are trying to output.

PowerShell version 3:

Clear
Write-Host 'Test'
Start-Sleep 1
$psise.CurrentPowerShellTab.ConsolePane.Text | Set-Content -Path iseoutput.txt

PowerShell version 2:

Clear
Write-Host 'Test'
Start-Sleep 1
$psise.CurrentPowerShellTab.Output.Text | Set-Content -Path iseoutput.txt

This was the best I could find as Powershell ISE doesn't use Pause like cmd. Another option is if it is possible for you to run your script in Powershell (not ISE) then you can pause output with Ctrl+s.

If this is not what you are looking for, I am sorry as I only use Powershell (not ISE) instead of cmd.

jmc302005

Posted 2013-11-05T11:26:11.417

Reputation: 713

1could not believe ISE does not support CTRL+s/q yet the standard powershell command window does. Thanks for the clarification. – rob – 2016-12-02T16:23:01.167