![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Setting width of output Hi all, I am wondering if there is some command/method to change the width of the output from powershell? I've noticed that when called from another process, the display width is truncated to 80 chars and I would like to change this. Any ideas on how to do it? -- Regards, Peter |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Setting width of output i believe in powershell.exe its going to be the width on your console screen which you can set in windows the same as you do for cmd.exe (i think it can be done visually , right click properties, as well as with cmdline options when starting cmd.exe or powershell.exe in powershell analyzer, i have a fulldown that allows you to determine the width of the console on the fly. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Setting width of output Thanks for the reply. Unfortunately, I haven't been able to find a command parameter that changes the output buffer width and changing the properties for the powershell or cmd window does nothing AFAICS. Do you know the cmd line parameter required or do you know where I can find more info about setting the output width? -- Regards, Peter <klumsy@xtra.co.nz> skrev i meddelandet news:1163206271.398933.21330@k70g2000cwa.googlegroups.com... >i believe in powershell.exe its going to be the width on your console > screen which you can set in windows the same as you do for cmd.exe (i > think it can be done visually , right click properties, as well as with > cmdline options when starting cmd.exe or powershell.exe > > in powershell analyzer, i have a fulldown that allows you to determine > the width of the console on the fly. > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Setting width of output Can you provide an example of what you are doing with calling PS and saving the output? There are several ways to handle this, including setting width in Out-File, using a different output format, and directly exporting to a specific file type either using export-csv or a custom data exporter. "Peter Thornqvist" <peter.tornqvist@gmail.com> wrote in message news:uj6spQZBHHA.5068@TK2MSFTNGP02.phx.gbl... > Thanks for the reply. Unfortunately, I haven't been able to find a command > parameter that changes the output buffer width and changing the properties > for the powershell or cmd window does nothing AFAICS. Do you know the cmd > line parameter required or do you know where I can find more info about > setting the output width? > > -- > Regards, Peter > > <klumsy@xtra.co.nz> skrev i meddelandet > news:1163206271.398933.21330@k70g2000cwa.googlegroups.com... >>i believe in powershell.exe its going to be the width on your console >> screen which you can set in windows the same as you do for cmd.exe (i >> think it can be done visually , right click properties, as well as with >> cmdline options when starting cmd.exe or powershell.exe >> >> in powershell analyzer, i have a fulldown that allows you to determine >> the width of the console on the fly. >> > > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Setting width of output Peter, I am not certain if this is what you are interested in or not. Try this and report back if it does what you need or not. $bufferSize = new-object System.Management.Automation.Host.Size 120,60 $host.UI.RawUI.WindowSize = $bufferSize Andrew Watt MVP On Sat, 11 Nov 2006 14:20:30 +0100, "Peter Thornqvist" <peter.tornqvist@gmail.com> wrote: >Thanks for the reply. Unfortunately, I haven't been able to find a command >parameter that changes the output buffer width and changing the properties >for the powershell or cmd window does nothing AFAICS. Do you know the cmd >line parameter required or do you know where I can find more info about >setting the output width? |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Setting width of output > $bufferSize = new-object System.Management.Automation.Host.Size 120,60 > $host.UI.RawUI.WindowSize = $bufferSize If I add the buffer size to the command, it does work very well (without buffer size I get an error that windowsize cannot be larger than buffersize): $bufferSize = new-object System.Management.Automation.Host.Size 160,80 $host.UI.RawUI.BufferSize = $bufferSize $host.UI.RawUI.WindowSize = $bufferSize This lead me to try to set the buffer size in cmd.exe as well as PowerShell, without results. *Then it hit me*. I had been changing the PowerShell shortcut on my Start menu all the time. Thi, of course, isn't used when FB calls CreatePRocess. So, I tried starting powershell directly from the powershell folder and change the settings there and BINGO! That did it! Still, if anyone knows about a command that I can send to PowerShell to change display width, I'd appreciate it a lot. -- Regards, Peter |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Setting width of output > Can you provide an example of what you are doing with calling PS and > saving > the output? There are several ways to handle this, including setting width > in Out-File, using a different output format, and directly exporting to a > specific file type either using export-csv or a custom data exporter. OK, let's see if I can explain this in more detail: I am writing an action for an automation tool (FinalBuilder) where the user can execute a PowerShell command or script. When the action is run, the output in FB's log window is truncated to 80 chars. I've asked the FB people and they say that they don't truncate, so my guess it's PS. I've tried various commands to try to expand the line width and the best I've come up with is to pipe through Out-String specifying -stream -width 200 although the output is far from optimal (the extra line wraps is due to FB wrapping at 80 chars, not PS). The optimal solution for me is if there was a setting I could apply globally to the PowerShell window without having to append it to the command-line. If this was possible, I could include a property in the action to change the output width (much as is done in PowerShell Analyzer). I'm pretty sure FB uses CreateProcess to call PS, so that might play into it as well. I tried to attach some screenshots, but the article was too large, so you'll just have to picture it internally ![]() Any hints/ideas appreciated -- Regards, Peter |
My System Specs![]() |
| | #8 (permalink) |
| | Re: Setting width of output I haven't forgotten this; I was waiting for an opportunity to install FB evaluation and check some things. Still need to finish that, but I already have some comments inline... "Peter Thornqvist" <peter.tornqvist@gmail.com> wrote in message news:%23spJ9DbBHHA.4864@TK2MSFTNGP04.phx.gbl... >> Can you provide an example of what you are doing with calling PS and >> saving the output? There are several ways to handle this... > I am writing an action for an automation tool (FinalBuilder) where the > user > can execute a PowerShell command or script. When the action is run, the > output in FB's log window is truncated to 80 chars. > I've asked the FB people and they say that they don't truncate, so my > guess > it's PS. Sort of. I suspect FB is generating a default console process and the way in which things get retrieved is that the host text stream is grabbed - which is already passed through the formatter. In any case, the display is always going to be affected by the selection of items to display. At the moment, I suspect your best bet is to use '-outputformat xml' in the command; for example: powershell -OutputFormat xml -command "& {get-eventlog -logname security}" If you test this from a cmd.exe command prompt and redirect to a file, you'll see that data is NOT truncated. > I've tried various commands to try to expand the line width and the best > I've come up with is to pipe through Out-String specifying -stream -width > 200 although the output is far from optimal (the extra line wraps is due > to FB wrapping at 80 chars, not PS). > > The optimal solution for me is if there was a setting I could apply > globally to the PowerShell window without having to append it to the > command-line. If this was possible, I could include a property in the > action > to change the output width (much as is done in PowerShell Analyzer). > > I'm pretty sure FB uses CreateProcess to call PS, so that might play into > it > as well. > > I tried to attach some screenshots, but the article was too large, so > you'll just have to picture it internally ![]() > > Any hints/ideas appreciated > > -- > Regards, Peter > > > |
My System Specs![]() |
| | #9 (permalink) |
| | Re: Setting width of output Cool, thanks. BTW, you can get the PS action from the Community Download on the FB page. You can see how the output looks when running a PS command from within FB. Thanks again -- Regards, Peter "Alex K. Angelopoulos [MVP]" <aka@online.mvps.org> skrev i meddelandet news:OLtIb8xCHHA.4808@TK2MSFTNGP03.phx.gbl... >I haven't forgotten this; I was waiting for an opportunity to install FB >evaluation and check some things. Still need to finish that, but I already >have some comments inline... > > "Peter Thornqvist" <peter.tornqvist@gmail.com> wrote in message > news:%23spJ9DbBHHA.4864@TK2MSFTNGP04.phx.gbl... >>> Can you provide an example of what you are doing with calling PS and >>> saving the output? There are several ways to handle this... > >> I am writing an action for an automation tool (FinalBuilder) where the >> user >> can execute a PowerShell command or script. When the action is run, the >> output in FB's log window is truncated to 80 chars. >> I've asked the FB people and they say that they don't truncate, so my >> guess >> it's PS. > > Sort of. I suspect FB is generating a default console process and the way > in which things get retrieved is that the host text stream is grabbed - > which is already passed through the formatter. In any case, the display is > always going to be affected by the selection of items to display. > > At the moment, I suspect your best bet is to use '-outputformat xml' in > the command; for example: > powershell -OutputFormat xml -command "& {get-eventlog -logname > security}" > If you test this from a cmd.exe command prompt and redirect to a file, > you'll see that data is NOT truncated. > > >> I've tried various commands to try to expand the line width and the best >> I've come up with is to pipe through Out-String specifying -stream -width >> 200 although the output is far from optimal (the extra line wraps is due >> to FB wrapping at 80 chars, not PS). >> >> The optimal solution for me is if there was a setting I could apply >> globally to the PowerShell window without having to append it to the >> command-line. If this was possible, I could include a property in the >> action >> to change the output width (much as is done in PowerShell Analyzer). >> >> I'm pretty sure FB uses CreateProcess to call PS, so that might play into >> it >> as well. >> >> I tried to attach some screenshots, but the article was too large, so >> you'll just have to picture it internally ![]() >> >> Any hints/ideas appreciated >> >> -- >> Regards, Peter >> >> >> > > |
My System Specs![]() |
| | #10 (permalink) |
| | Re: Setting width of output Peter Thornqvist schrieb: > Hi all, I am wondering if there is some command/method to change the width > of the output from powershell? I've noticed that when called from another > process, the display width is truncated to 80 chars and I would like to > change this. Any ideas on how to do it? > What about mode con cols=132? Peter |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| formatting output column width | PowerShell | |||
| Setting Output Cacheability Programmatically is Not Working - In Custom Handler | .NET General | |||
| Setting per Application Sound Output, or Per Sound Type Outputs... | Vista General | |||
| Scrollbar width | Vista General | |||
| Validation needed: Tabular output throws OutofMemoryException errors with Out-File -Width 0x7fffffff | PowerShell | |||