Forum Discussion
Getting powershell to scroll horizontally instead of word wrap
Hi, Taras.
Try the following, where in this example, I've used a buffer width of 256.
$host.UI.RawUI.BufferSize = [System.Management.Automation.Host.Size]::new(256, ($host.UI.RawUI.BufferSize.Height));
Note: This is only worth using under the default shells. If you try it under Windows Terminal, it creates issues as Windows Terminal suppresses the horizontal scroll bar.
Cheers,
Lain
- sawtooth500May 13, 2024Copper ContributorI tried using both Get-Content and $host.UI.RawUI.BufferSize = [System.Management.Automation.Host.Size]::new(256, ($host.UI.RawUI.BufferSize.Height)); neither gave me a horizontal scroll. To clarify, I do NOT want it to wrap, I want it to horizontally scroll instead of wrapping.- LainRobertsonMay 13, 2024Silver ContributorAre you using the standard shell? I've tested the standard shells for both Windows PowerShell and PowerShell and I do get the horizontal scroll bar as show below. Given you said you wanted a value of 7,000, you might want to try that instead of the 256 value I was using, since if your current width is greater than 256 characters, you wouldn't expect to see a horizontal scroll bar. Windows PowerShell initial screen set to a display width of 120 charactersWindows PowerShell screen after running the buffer change command (set to 256 characters width) showing horizontal scroll barThe PowerShell default shell behaves the same way, so I haven't bothered including the almost-identical screenshots from it. Cheers, Lain - sawtooth500May 13, 2024Copper ContributorI'm guessing I must be doing something wrong then...
 https://youtu.be/jZk0wmKtn7w
 That's a recording of me trying to change the buffer size as you suggested Lain. As you see with some sample content I have there, it's line wrapping. If I extend the window onto my second monitor, the wrapping stops. Let me know what I'm doing wrong, thanks.