• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Format Issue

  • Thread starter Brandon Shell [MVP]
  • Start date
B

Brandon Shell [MVP]

#1
Out-File has -width parameter

You may also want the -auto flag for Format-Table

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

TM> I'm piping a command through Format-Table and then to Out-File. I'm
TM> asking for a single column that is pretty wide. It truncates the
TM> column and puts ... at the end. I can't remember how to expand it
TM> to give me everything.
TM>
TM> ----------------------------------------------------
TM> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM> SQL Server MVP
TM> Toronto, ON Canada
TM> https://mvp.support.microsoft.com/profile/Tom.Moreau
 
T

Tom Moreau

#2
I'm piping a command through Format-Table and then to Out-File. I'm asking
for a single column that is pretty wide. It truncates the column and puts
.... at the end. I can't remember how to expand it to give me everything.

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
 
T

Tom Moreau

#3
It's almost working. I had tried the -AutoSize parameter for Format-Table
and it didn't make any difference. However, the -Width parameter for
Out-File does. That said, I don't like the fact that it pads blanks onto
lines that are shorter than the specified width. Is there some way of
expanding that doesn't put unnecessary whitespace?

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
news:29d4f64638ba8ca2800c7023b18@xxxxxx
Out-File has -width parameter

You may also want the -auto flag for Format-Table

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

TM> I'm piping a command through Format-Table and then to Out-File. I'm
TM> asking for a single column that is pretty wide. It truncates the
TM> column and puts ... at the end. I can't remember how to expand it
TM> to give me everything.
TM>
TM> ----------------------------------------------------
TM> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM> SQL Server MVP
TM> Toronto, ON Canada
TM> https://mvp.support.microsoft.com/profile/Tom.Moreau
 
B

Brandon Shell [MVP]

#4
I find that its best to format the data yourself when piping to a file

I can provide you example if you gimme an idea of what your looking for.

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

TM> It's almost working. I had tried the -AutoSize parameter for
TM> Format-Table and it didn't make any difference. However, the -Width
TM> parameter for Out-File does. That said, I don't like the fact that
TM> it pads blanks onto lines that are shorter than the specified width.
TM> Is there some way of expanding that doesn't put unnecessary
TM> whitespace?
TM>
TM> ----------------------------------------------------
TM> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM> SQL Server MVP
TM> Toronto, ON Canada
TM> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM> news:29d4f64638ba8ca2800c7023b18@xxxxxx
TM> Out-File has -width parameter
TM> You may also want the -auto flag for Format-Table
TM>
TM> Brandon Shell
TM> ---------------
TM> Blog: http://www.bsonposh.com/
TM> PSH Scripts Project: www.codeplex.com/psobject
TM>> I'm piping a command through Format-Table and then to Out-File.
TM>> I'm asking for a single column that is pretty wide. It truncates
TM>> the column and puts ... at the end. I can't remember how to expand
TM>> it to give me everything.
TM>>
TM>> ----------------------------------------------------
TM>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>> SQL Server MVP
TM>> Toronto, ON Canada
TM>> https://mvp.support.microsoft.com/profile/Tom.Moreau
 
T

Tom Moreau

#5
Right now, I'm just trying to save the command history. Where I have a
problem is if the command has a lot of characters in it. I've got the rest
down fine; it's just that width thing...

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
news:29d4f64638bf8ca28044f562e9f@xxxxxx
I find that its best to format the data yourself when piping to a file

I can provide you example if you gimme an idea of what your looking for.

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

TM> It's almost working. I had tried the -AutoSize parameter for
TM> Format-Table and it didn't make any difference. However, the -Width
TM> parameter for Out-File does. That said, I don't like the fact that
TM> it pads blanks onto lines that are shorter than the specified width.
TM> Is there some way of expanding that doesn't put unnecessary
TM> whitespace?
TM>
TM> ----------------------------------------------------
TM> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM> SQL Server MVP
TM> Toronto, ON Canada
TM> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM> news:29d4f64638ba8ca2800c7023b18@xxxxxx
TM> Out-File has -width parameter
TM> You may also want the -auto flag for Format-Table
TM>
TM> Brandon Shell
TM> ---------------
TM> Blog: http://www.bsonposh.com/
TM> PSH Scripts Project: www.codeplex.com/psobject
TM>> I'm piping a command through Format-Table and then to Out-File.
TM>> I'm asking for a single column that is pretty wide. It truncates
TM>> the column and puts ... at the end. I can't remember how to expand
TM>> it to give me everything.
TM>>
TM>> ----------------------------------------------------
TM>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>> SQL Server MVP
TM>> Toronto, ON Canada
TM>> https://mvp.support.microsoft.com/profile/Tom.Moreau
 
B

Brandon Shell [MVP]

#6
have you looked at

Start-Transcript
http://technet.microsoft.com/en-us/library/bb978600.aspx

and

Stop-Transcript
http://technet.microsoft.com/en-us/library/bb978567.aspx

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

TM> Right now, I'm just trying to save the command history. Where I
TM> have a problem is if the command has a lot of characters in it.
TM> I've got the rest down fine; it's just that width thing...
TM>
TM> ----------------------------------------------------
TM> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM> SQL Server MVP
TM> Toronto, ON Canada
TM> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM> news:29d4f64638bf8ca28044f562e9f@xxxxxx
TM> I find that its best to format the data yourself when piping to a
TM> file
TM> I can provide you example if you gimme an idea of what your looking
TM> for.
TM>
TM> Brandon Shell
TM> ---------------
TM> Blog: http://www.bsonposh.com/
TM> PSH Scripts Project: www.codeplex.com/psobject
TM>> It's almost working. I had tried the -AutoSize parameter for
TM>> Format-Table and it didn't make any difference. However, the
TM>> -Width parameter for Out-File does. That said, I don't like the
TM>> fact that it pads blanks onto lines that are shorter than the
TM>> specified width. Is there some way of expanding that doesn't put
TM>> unnecessary whitespace?
TM>>
TM>> ----------------------------------------------------
TM>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>> SQL Server MVP
TM>> Toronto, ON Canada
TM>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM>> news:29d4f64638ba8ca2800c7023b18@xxxxxx
TM>> Out-File has -width parameter
TM>> You may also want the -auto flag for Format-Table
TM>> Brandon Shell
TM>> ---------------
TM>> Blog: http://www.bsonposh.com/
TM>> PSH Scripts Project: www.codeplex.com/psobject
TM>>> I'm piping a command through Format-Table and then to Out-File.
TM>>> I'm asking for a single column that is pretty wide. It truncates
TM>>> the column and puts ... at the end. I can't remember how to
TM>>> expand
TM>>> it to give me everything.
TM>>> ----------------------------------------------------
TM>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>> SQL Server MVP
TM>>> Toronto, ON Canada
TM>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
 
S

Shay Levi

#7
Try

format-table -auto -wrap


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com

> Wow! I did not know that! Thanx!
>
> That said, I'm still wondering how to make the complete width of a
> wide column show up, regardless of whether or not I'm saving to a
> file.
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
> news:29d4f64638c58ca2808c41fdd8f@xxxxxx
> have you looked at
> Start-Transcript
> http://technet.microsoft.com/en-us/library/bb978600.aspx
> and
>
> Stop-Transcript
> http://technet.microsoft.com/en-us/library/bb978567.aspx
> Brandon Shell
> ---------------
> Blog: http://www.bsonposh.com/
> PSH Scripts Project: www.codeplex.com/psobject
TM>> Right now, I'm just trying to save the command history. Where I
TM>> have a problem is if the command has a lot of characters in it.
TM>> I've got the rest down fine; it's just that width thing...
TM>>
TM>> ----------------------------------------------------
TM>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>> SQL Server MVP
TM>> Toronto, ON Canada
TM>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM>> news:29d4f64638bf8ca28044f562e9f@xxxxxx
TM>> I find that its best to format the data yourself when piping to a
TM>> file
TM>> I can provide you example if you gimme an idea of what your looking
TM>> for.
TM>> Brandon Shell
TM>> ---------------
TM>> Blog: http://www.bsonposh.com/
TM>> PSH Scripts Project: www.codeplex.com/psobject
TM>>> It's almost working. I had tried the -AutoSize parameter for
TM>>> Format-Table and it didn't make any difference. However, the
TM>>> -Width parameter for Out-File does. That said, I don't like the
TM>>> fact that it pads blanks onto lines that are shorter than the
TM>>> specified width. Is there some way of expanding that doesn't put
TM>>> unnecessary whitespace?
TM>>>
TM>>> ----------------------------------------------------
TM>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>> SQL Server MVP
TM>>> Toronto, ON Canada
TM>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM>>> news:29d4f64638ba8ca2800c7023b18@xxxxxx
TM>>> Out-File has -width parameter
TM>>> You may also want the -auto flag for Format-Table
TM>>> Brandon Shell
TM>>> ---------------
TM>>> Blog: http://www.bsonposh.com/
TM>>> PSH Scripts Project: www.codeplex.com/psobject
TM>>>> I'm piping a command through Format-Table and then to Out-File.
TM>>>> I'm asking for a single column that is pretty wide. It truncates
TM>>>> the column and puts ... at the end. I can't remember how to
TM>>>> expand
TM>>>> it to give me everything.
TM>>>> ----------------------------------------------------
TM>>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>>> SQL Server MVP
TM>>>> Toronto, ON Canada
TM>>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
 
T

Tom Moreau

#8
Wow! I did not know that! Thanx!

That said, I'm still wondering how to make the complete width of a wide
column show up, regardless of whether or not I'm saving to a file.


--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
news:29d4f64638c58ca2808c41fdd8f@xxxxxx
have you looked at

Start-Transcript
http://technet.microsoft.com/en-us/library/bb978600.aspx

and

Stop-Transcript
http://technet.microsoft.com/en-us/library/bb978567.aspx

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

TM> Right now, I'm just trying to save the command history. Where I
TM> have a problem is if the command has a lot of characters in it.
TM> I've got the rest down fine; it's just that width thing...
TM>
TM> ----------------------------------------------------
TM> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM> SQL Server MVP
TM> Toronto, ON Canada
TM> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM> news:29d4f64638bf8ca28044f562e9f@xxxxxx
TM> I find that its best to format the data yourself when piping to a
TM> file
TM> I can provide you example if you gimme an idea of what your looking
TM> for.
TM>
TM> Brandon Shell
TM> ---------------
TM> Blog: http://www.bsonposh.com/
TM> PSH Scripts Project: www.codeplex.com/psobject
TM>> It's almost working. I had tried the -AutoSize parameter for
TM>> Format-Table and it didn't make any difference. However, the
TM>> -Width parameter for Out-File does. That said, I don't like the
TM>> fact that it pads blanks onto lines that are shorter than the
TM>> specified width. Is there some way of expanding that doesn't put
TM>> unnecessary whitespace?
TM>>
TM>> ----------------------------------------------------
TM>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>> SQL Server MVP
TM>> Toronto, ON Canada
TM>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM>> news:29d4f64638ba8ca2800c7023b18@xxxxxx
TM>> Out-File has -width parameter
TM>> You may also want the -auto flag for Format-Table
TM>> Brandon Shell
TM>> ---------------
TM>> Blog: http://www.bsonposh.com/
TM>> PSH Scripts Project: www.codeplex.com/psobject
TM>>> I'm piping a command through Format-Table and then to Out-File.
TM>>> I'm asking for a single column that is pretty wide. It truncates
TM>>> the column and puts ... at the end. I can't remember how to
TM>>> expand
TM>>> it to give me everything.
TM>>> ----------------------------------------------------
TM>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>> SQL Server MVP
TM>>> Toronto, ON Canada
TM>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
 
T

Tom Moreau

#9
That's not bad, but as its name implies, it wraps to the next line. I'd
like it just to give me the full width without wrapping.

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Shay Levi" <no@xxxxxx> wrote in message
news:8766a9441aada8ca28449cfc0428@xxxxxx
Try

format-table -auto -wrap


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com

> Wow! I did not know that! Thanx!
>
> That said, I'm still wondering how to make the complete width of a
> wide column show up, regardless of whether or not I'm saving to a
> file.
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
> news:29d4f64638c58ca2808c41fdd8f@xxxxxx
> have you looked at
> Start-Transcript
> http://technet.microsoft.com/en-us/library/bb978600.aspx
> and
>
> Stop-Transcript
> http://technet.microsoft.com/en-us/library/bb978567.aspx
> Brandon Shell
> ---------------
> Blog: http://www.bsonposh.com/
> PSH Scripts Project: www.codeplex.com/psobject
TM>> Right now, I'm just trying to save the command history. Where I
TM>> have a problem is if the command has a lot of characters in it.
TM>> I've got the rest down fine; it's just that width thing...
TM>>
TM>> ----------------------------------------------------
TM>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>> SQL Server MVP
TM>> Toronto, ON Canada
TM>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM>> news:29d4f64638bf8ca28044f562e9f@xxxxxx
TM>> I find that its best to format the data yourself when piping to a
TM>> file
TM>> I can provide you example if you gimme an idea of what your looking
TM>> for.
TM>> Brandon Shell
TM>> ---------------
TM>> Blog: http://www.bsonposh.com/
TM>> PSH Scripts Project: www.codeplex.com/psobject
TM>>> It's almost working. I had tried the -AutoSize parameter for
TM>>> Format-Table and it didn't make any difference. However, the
TM>>> -Width parameter for Out-File does. That said, I don't like the
TM>>> fact that it pads blanks onto lines that are shorter than the
TM>>> specified width. Is there some way of expanding that doesn't put
TM>>> unnecessary whitespace?
TM>>>
TM>>> ----------------------------------------------------
TM>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>> SQL Server MVP
TM>>> Toronto, ON Canada
TM>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM>>> news:29d4f64638ba8ca2800c7023b18@xxxxxx
TM>>> Out-File has -width parameter
TM>>> You may also want the -auto flag for Format-Table
TM>>> Brandon Shell
TM>>> ---------------
TM>>> Blog: http://www.bsonposh.com/
TM>>> PSH Scripts Project: www.codeplex.com/psobject
TM>>>> I'm piping a command through Format-Table and then to Out-File.
TM>>>> I'm asking for a single column that is pretty wide. It truncates
TM>>>> the column and puts ... at the end. I can't remember how to
TM>>>> expand
TM>>>> it to give me everything.
TM>>>> ----------------------------------------------------
TM>>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>>> SQL Server MVP
TM>>>> Toronto, ON Canada
TM>>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
 
S

Shay Levi

#10
You can out-file with a -width enough to accommodate the longest string.


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com

> That's not bad, but as its name implies, it wraps to the next line.
> I'd like it just to give me the full width without wrapping.
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
> "Shay Levi" <no@xxxxxx> wrote in message
> news:8766a9441aada8ca28449cfc0428@xxxxxx Try
>
> format-table -auto -wrap
>
> -----
> Shay Levi
> $cript Fanatic
> http://scriptolog.blogspot.com

>> Wow! I did not know that! Thanx!
>>
>> That said, I'm still wondering how to make the complete width of a
>> wide column show up, regardless of whether or not I'm saving to a
>> file.
>>
>> ----------------------------------------------------
>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
>> SQL Server MVP
>> Toronto, ON Canada
>> https://mvp.support.microsoft.com/profile/Tom.Moreau
>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
>> news:29d4f64638c58ca2808c41fdd8f@xxxxxx
>> have you looked at
>> Start-Transcript
>> http://technet.microsoft.com/en-us/library/bb978600.aspx
>> and
>> Stop-Transcript
>> http://technet.microsoft.com/en-us/library/bb978567.aspx
>> Brandon Shell
>> ---------------
>> Blog: http://www.bsonposh.com/
>> PSH Scripts Project: www.codeplex.com/psobject
TM>>> Right now, I'm just trying to save the command history. Where I
TM>>> have a problem is if the command has a lot of characters in it.
TM>>> I've got the rest down fine; it's just that width thing...
TM>>>
TM>>> ----------------------------------------------------
TM>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>> SQL Server MVP
TM>>> Toronto, ON Canada
TM>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM>>> news:29d4f64638bf8ca28044f562e9f@xxxxxx
TM>>> I find that its best to format the data yourself when piping to a
TM>>> file
TM>>> I can provide you example if you gimme an idea of what your
TM>>> looking
TM>>> for.
TM>>> Brandon Shell
TM>>> ---------------
TM>>> Blog: http://www.bsonposh.com/
TM>>> PSH Scripts Project: www.codeplex.com/psobject
TM>>>> It's almost working. I had tried the -AutoSize parameter for
TM>>>> Format-Table and it didn't make any difference. However, the
TM>>>> -Width parameter for Out-File does. That said, I don't like the
TM>>>> fact that it pads blanks onto lines that are shorter than the
TM>>>> specified width. Is there some way of expanding that doesn't put
TM>>>> unnecessary whitespace?
TM>>>>
TM>>>> ----------------------------------------------------
TM>>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>>> SQL Server MVP
TM>>>> Toronto, ON Canada
TM>>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>>>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in
TM>>>> message
TM>>>> news:29d4f64638ba8ca2800c7023b18@xxxxxx
TM>>>> Out-File has -width parameter
TM>>>> You may also want the -auto flag for Format-Table
TM>>>> Brandon Shell
TM>>>> ---------------
TM>>>> Blog: http://www.bsonposh.com/
TM>>>> PSH Scripts Project: www.codeplex.com/psobject
TM>>>>> I'm piping a command through Format-Table and then to Out-File.
TM>>>>> I'm asking for a single column that is pretty wide. It
TM>>>>> truncates
TM>>>>> the column and puts ... at the end. I can't remember how to
TM>>>>> expand
TM>>>>> it to give me everything.
TM>>>>> ----------------------------------------------------
TM>>>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>>>> SQL Server MVP
TM>>>>> Toronto, ON Canada
TM>>>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
 
T

Tom Moreau

#11
As I reported earlier, I don't want the extra baggage of the padded blanks.
Also, what if I don't know what the widest field is going to be?

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Shay Levi" <no@xxxxxx> wrote in message
news:8766a9441aae28ca2847f47366ee@xxxxxx
You can out-file with a -width enough to accommodate the longest string.


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com

> That's not bad, but as its name implies, it wraps to the next line.
> I'd like it just to give me the full width without wrapping.
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
> "Shay Levi" <no@xxxxxx> wrote in message
> news:8766a9441aada8ca28449cfc0428@xxxxxx Try
>
> format-table -auto -wrap
>
> -----
> Shay Levi
> $cript Fanatic
> http://scriptolog.blogspot.com

>> Wow! I did not know that! Thanx!
>>
>> That said, I'm still wondering how to make the complete width of a
>> wide column show up, regardless of whether or not I'm saving to a
>> file.
>>
>> ----------------------------------------------------
>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
>> SQL Server MVP
>> Toronto, ON Canada
>> https://mvp.support.microsoft.com/profile/Tom.Moreau
>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
>> news:29d4f64638c58ca2808c41fdd8f@xxxxxx
>> have you looked at
>> Start-Transcript
>> http://technet.microsoft.com/en-us/library/bb978600.aspx
>> and
>> Stop-Transcript
>> http://technet.microsoft.com/en-us/library/bb978567.aspx
>> Brandon Shell
>> ---------------
>> Blog: http://www.bsonposh.com/
>> PSH Scripts Project: www.codeplex.com/psobject
TM>>> Right now, I'm just trying to save the command history. Where I
TM>>> have a problem is if the command has a lot of characters in it.
TM>>> I've got the rest down fine; it's just that width thing...
TM>>>
TM>>> ----------------------------------------------------
TM>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>> SQL Server MVP
TM>>> Toronto, ON Canada
TM>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM>>> news:29d4f64638bf8ca28044f562e9f@xxxxxx
TM>>> I find that its best to format the data yourself when piping to a
TM>>> file
TM>>> I can provide you example if you gimme an idea of what your
TM>>> looking
TM>>> for.
TM>>> Brandon Shell
TM>>> ---------------
TM>>> Blog: http://www.bsonposh.com/
TM>>> PSH Scripts Project: www.codeplex.com/psobject
TM>>>> It's almost working. I had tried the -AutoSize parameter for
TM>>>> Format-Table and it didn't make any difference. However, the
TM>>>> -Width parameter for Out-File does. That said, I don't like the
TM>>>> fact that it pads blanks onto lines that are shorter than the
TM>>>> specified width. Is there some way of expanding that doesn't put
TM>>>> unnecessary whitespace?
TM>>>>
TM>>>> ----------------------------------------------------
TM>>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>>> SQL Server MVP
TM>>>> Toronto, ON Canada
TM>>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>>>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in
TM>>>> message
TM>>>> news:29d4f64638ba8ca2800c7023b18@xxxxxx
TM>>>> Out-File has -width parameter
TM>>>> You may also want the -auto flag for Format-Table
TM>>>> Brandon Shell
TM>>>> ---------------
TM>>>> Blog: http://www.bsonposh.com/
TM>>>> PSH Scripts Project: www.codeplex.com/psobject
TM>>>>> I'm piping a command through Format-Table and then to Out-File.
TM>>>>> I'm asking for a single column that is pretty wide. It
TM>>>>> truncates
TM>>>>> the column and puts ... at the end. I can't remember how to
TM>>>>> expand
TM>>>>> it to give me everything.
TM>>>>> ----------------------------------------------------
TM>>>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>>>> SQL Server MVP
TM>>>>> Toronto, ON Canada
TM>>>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
 
T

Tom Moreau

#12
I've played with this a bit and what it does is output the command as well
as the output produced by the command. It should give you the option of
just the command.

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
news:29d4f64638c58ca2808c41fdd8f@xxxxxx
have you looked at

Start-Transcript
http://technet.microsoft.com/en-us/library/bb978600.aspx

and

Stop-Transcript
http://technet.microsoft.com/en-us/library/bb978567.aspx

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

TM> Right now, I'm just trying to save the command history. Where I
TM> have a problem is if the command has a lot of characters in it.
TM> I've got the rest down fine; it's just that width thing...
TM>
TM> ----------------------------------------------------
TM> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM> SQL Server MVP
TM> Toronto, ON Canada
TM> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM> news:29d4f64638bf8ca28044f562e9f@xxxxxx
TM> I find that its best to format the data yourself when piping to a
TM> file
TM> I can provide you example if you gimme an idea of what your looking
TM> for.
TM>
TM> Brandon Shell
TM> ---------------
TM> Blog: http://www.bsonposh.com/
TM> PSH Scripts Project: www.codeplex.com/psobject
TM>> It's almost working. I had tried the -AutoSize parameter for
TM>> Format-Table and it didn't make any difference. However, the
TM>> -Width parameter for Out-File does. That said, I don't like the
TM>> fact that it pads blanks onto lines that are shorter than the
TM>> specified width. Is there some way of expanding that doesn't put
TM>> unnecessary whitespace?
TM>>
TM>> ----------------------------------------------------
TM>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>> SQL Server MVP
TM>> Toronto, ON Canada
TM>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM>> news:29d4f64638ba8ca2800c7023b18@xxxxxx
TM>> Out-File has -width parameter
TM>> You may also want the -auto flag for Format-Table
TM>> Brandon Shell
TM>> ---------------
TM>> Blog: http://www.bsonposh.com/
TM>> PSH Scripts Project: www.codeplex.com/psobject
TM>>> I'm piping a command through Format-Table and then to Out-File.
TM>>> I'm asking for a single column that is pretty wide. It truncates
TM>>> the column and puts ... at the end. I can't remember how to
TM>>> expand
TM>>> it to give me everything.
TM>>> ----------------------------------------------------
TM>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>> SQL Server MVP
TM>>> Toronto, ON Canada
TM>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
 
S

Shay Levi

#13
You can get just the CommandLine column with the -property parameter:

get-history | format-table -auto -wrap commandLine | ...


All Format-* cmdlets will pad spaces, it's by design. They are best suited
for console display.
If you need to format it the way you want, you'll have to write your own
code.


If only one column is needed, try this:

get-history | foreach { $_.commandLine } | set-content .\commands.txt


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com

> I've played with this a bit and what it does is output the command as
> well as the output produced by the command. It should give you the
> option of just the command.
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
> news:29d4f64638c58ca2808c41fdd8f@xxxxxx
> have you looked at
> Start-Transcript
> http://technet.microsoft.com/en-us/library/bb978600.aspx
> and
>
> Stop-Transcript
> http://technet.microsoft.com/en-us/library/bb978567.aspx
> Brandon Shell
> ---------------
> Blog: http://www.bsonposh.com/
> PSH Scripts Project: www.codeplex.com/psobject
TM>> Right now, I'm just trying to save the command history. Where I
TM>> have a problem is if the command has a lot of characters in it.
TM>> I've got the rest down fine; it's just that width thing...
TM>>
TM>> ----------------------------------------------------
TM>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>> SQL Server MVP
TM>> Toronto, ON Canada
TM>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM>> news:29d4f64638bf8ca28044f562e9f@xxxxxx
TM>> I find that its best to format the data yourself when piping to a
TM>> file
TM>> I can provide you example if you gimme an idea of what your looking
TM>> for.
TM>> Brandon Shell
TM>> ---------------
TM>> Blog: http://www.bsonposh.com/
TM>> PSH Scripts Project: www.codeplex.com/psobject
TM>>> It's almost working. I had tried the -AutoSize parameter for
TM>>> Format-Table and it didn't make any difference. However, the
TM>>> -Width parameter for Out-File does. That said, I don't like the
TM>>> fact that it pads blanks onto lines that are shorter than the
TM>>> specified width. Is there some way of expanding that doesn't put
TM>>> unnecessary whitespace?
TM>>>
TM>>> ----------------------------------------------------
TM>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>> SQL Server MVP
TM>>> Toronto, ON Canada
TM>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM>>> news:29d4f64638ba8ca2800c7023b18@xxxxxx
TM>>> Out-File has -width parameter
TM>>> You may also want the -auto flag for Format-Table
TM>>> Brandon Shell
TM>>> ---------------
TM>>> Blog: http://www.bsonposh.com/
TM>>> PSH Scripts Project: www.codeplex.com/psobject
TM>>>> I'm piping a command through Format-Table and then to Out-File.
TM>>>> I'm asking for a single column that is pretty wide. It truncates
TM>>>> the column and puts ... at the end. I can't remember how to
TM>>>> expand
TM>>>> it to give me everything.
TM>>>> ----------------------------------------------------
TM>>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>>> SQL Server MVP
TM>>>> Toronto, ON Canada
TM>>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
 
T

Tom Moreau

#14
Aha! That last one worked:

get-history | foreach { $_.commandLine } | set-content .\commands.txt


Thanx much!

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Shay Levi" <no@xxxxxx> wrote in message
news:8766a9441aae68ca284d1283aa2c@xxxxxx
You can get just the CommandLine column with the -property parameter:

get-history | format-table -auto -wrap commandLine | ...


All Format-* cmdlets will pad spaces, it's by design. They are best suited
for console display.
If you need to format it the way you want, you'll have to write your own
code.


If only one column is needed, try this:

get-history | foreach { $_.commandLine } | set-content .\commands.txt


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com

> I've played with this a bit and what it does is output the command as
> well as the output produced by the command. It should give you the
> option of just the command.
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
> news:29d4f64638c58ca2808c41fdd8f@xxxxxx
> have you looked at
> Start-Transcript
> http://technet.microsoft.com/en-us/library/bb978600.aspx
> and
>
> Stop-Transcript
> http://technet.microsoft.com/en-us/library/bb978567.aspx
> Brandon Shell
> ---------------
> Blog: http://www.bsonposh.com/
> PSH Scripts Project: www.codeplex.com/psobject
TM>> Right now, I'm just trying to save the command history. Where I
TM>> have a problem is if the command has a lot of characters in it.
TM>> I've got the rest down fine; it's just that width thing...
TM>>
TM>> ----------------------------------------------------
TM>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>> SQL Server MVP
TM>> Toronto, ON Canada
TM>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM>> news:29d4f64638bf8ca28044f562e9f@xxxxxx
TM>> I find that its best to format the data yourself when piping to a
TM>> file
TM>> I can provide you example if you gimme an idea of what your looking
TM>> for.
TM>> Brandon Shell
TM>> ---------------
TM>> Blog: http://www.bsonposh.com/
TM>> PSH Scripts Project: www.codeplex.com/psobject
TM>>> It's almost working. I had tried the -AutoSize parameter for
TM>>> Format-Table and it didn't make any difference. However, the
TM>>> -Width parameter for Out-File does. That said, I don't like the
TM>>> fact that it pads blanks onto lines that are shorter than the
TM>>> specified width. Is there some way of expanding that doesn't put
TM>>> unnecessary whitespace?
TM>>>
TM>>> ----------------------------------------------------
TM>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>> SQL Server MVP
TM>>> Toronto, ON Canada
TM>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
TM>>> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
TM>>> news:29d4f64638ba8ca2800c7023b18@xxxxxx
TM>>> Out-File has -width parameter
TM>>> You may also want the -auto flag for Format-Table
TM>>> Brandon Shell
TM>>> ---------------
TM>>> Blog: http://www.bsonposh.com/
TM>>> PSH Scripts Project: www.codeplex.com/psobject
TM>>>> I'm piping a command through Format-Table and then to Out-File.
TM>>>> I'm asking for a single column that is pretty wide. It truncates
TM>>>> the column and puts ... at the end. I can't remember how to
TM>>>> expand
TM>>>> it to give me everything.
TM>>>> ----------------------------------------------------
TM>>>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
TM>>>> SQL Server MVP
TM>>>> Toronto, ON Canada
TM>>>> https://mvp.support.microsoft.com/profile/Tom.Moreau
 
K

Keith Hill [MVP]

#15
"Tom Moreau" <tom@xxxxxx> wrote in message
news:eShS0IiWIHA.5448@xxxxxx

> As I reported earlier, I don't want the extra baggage of the padded
> blanks.
I've done this before to widen the output and trim off unnecessary spaces:

ghy -count 999 | select CommandLine | out-string -stream -width 999 |
%{$_.TrimEnd()} | Out-file commands.txt

--
Keith
 
K

Kiron

#16
Try this:

h -c (h -c 1).id | % {"$_".trimEnd()} > History.txt

# or...
h -c (h -c 1).id | % {$_ -replace ' +$'} > History.txt

--
Kiron