Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista Tutorial - How do I get format-table to drop that omission points (...) and display my data

Reply
 
Old 06-01-2006   #1 (permalink)
Harald Ums
Guest


 
 

How do I get format-table to drop that omission points (...) and display my data

I am doing:
PS C:\> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName

LastWriteTime FullName
------------- --------
23.08.2001 14:00:00
C:\WINDOWS\system32\drivers\etc\hosts
23.08.2001 14:00:00
C:\WINDOWS\system32\drivers\etc\lmho...
23.08.2001 14:00:00
C:\WINDOWS\system32\drivers\etc\netw...
23.08.2001 14:00:00
C:\WINDOWS\system32\drivers\etc\prot...
23.08.2001 14:00:00
C:\WINDOWS\system32\drivers\etc\serv...

I would strongly prefer a wordwrap here instead of limiting the output to .
But the whole thing is really bad, when redirecting the whole thing to a
file like:
PS C:\> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName
>a.txt


Still powershell seems to use the column width of my cmd window.
The whole thing gets even more ridiculous when piping the whole thing into a
non powershell command:
ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName | grep ices
finds the line when run in a 120 column window there is a match, but no
match when run in a 80 column window.





My System SpecsSystem Spec
Old 06-01-2006   #2 (permalink)
ebgreen
Guest


 
 

RE: How do I get format-table to drop that omission points (...) and d

I believe this will address the problem when sending to a file:

ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName | Out-File
a.txt

If you want to pipe it to some other command, then leave the ft pipe out
altogether. If you want the results fomatted then make the ft the last pipe
in the pipe line.

"Harald Ums" wrote:

> I am doing:
> PS C:\> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName
>
> LastWriteTime FullName
> ------------- --------
> 23.08.2001 14:00:00
> C:\WINDOWS\system32\drivers\etc\hosts
> 23.08.2001 14:00:00
> C:\WINDOWS\system32\drivers\etc\lmho...
> 23.08.2001 14:00:00
> C:\WINDOWS\system32\drivers\etc\netw...
> 23.08.2001 14:00:00
> C:\WINDOWS\system32\drivers\etc\prot...
> 23.08.2001 14:00:00
> C:\WINDOWS\system32\drivers\etc\serv...
>
> I would strongly prefer a wordwrap here instead of limiting the output to .
> But the whole thing is really bad, when redirecting the whole thing to a
> file like:
> PS C:\> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName
> >a.txt

>
> Still powershell seems to use the column width of my cmd window.
> The whole thing gets even more ridiculous when piping the whole thing into a
> non powershell command:
> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName | grep ices
> finds the line when run in a 120 column window there is a match, but no
> match when run in a 80 column window.
>
>
>
>
>

My System SpecsSystem Spec
Old 06-01-2006   #3 (permalink)
Harald Ums
Guest


 
 

Re: How do I get format-table to drop that omission points (...) and d

out-file a.txt
still results in ...

BTW it is not a format-table problem
ls C:\WINDOWS\system32\drivers\etc | select LastWriteTime,FullName | grep
ices

shows the same stupid behaviour

"ebgreen" <ebgreen@discussions.microsoft.com> wrote in message
news:BD7C8430-FFE3-44E0-893E-49AEB039420C@microsoft.com...
>I believe this will address the problem when sending to a file:
>
> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName | Out-File
> a.txt
>
> If you want to pipe it to some other command, then leave the ft pipe out
> altogether. If you want the results fomatted then make the ft the last
> pipe
> in the pipe line.
>
> "Harald Ums" wrote:
>
>> I am doing:
>> PS C:\> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName
>>
>> LastWriteTime FullName
>> ------------- --------
>> 23.08.2001 14:00:00
>> C:\WINDOWS\system32\drivers\etc\hosts
>> 23.08.2001 14:00:00
>> C:\WINDOWS\system32\drivers\etc\lmho...
>> 23.08.2001 14:00:00
>> C:\WINDOWS\system32\drivers\etc\netw...
>> 23.08.2001 14:00:00
>> C:\WINDOWS\system32\drivers\etc\prot...
>> 23.08.2001 14:00:00
>> C:\WINDOWS\system32\drivers\etc\serv...
>>
>> I would strongly prefer a wordwrap here instead of limiting the output to
>> .
>> But the whole thing is really bad, when redirecting the whole thing to a
>> file like:
>> PS C:\> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName
>> >a.txt

>>
>> Still powershell seems to use the column width of my cmd window.
>> The whole thing gets even more ridiculous when piping the whole thing
>> into a
>> non powershell command:
>> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName | grep
>> ices
>> finds the line when run in a 120 column window there is a match, but no
>> match when run in a 80 column window.
>>
>>
>>
>>
>>



My System SpecsSystem Spec
Old 06-01-2006   #4 (permalink)
Keith Hill [MVP]
Guest


 
 

Re: How do I get format-table to drop that omission points (...) and display my data

"Harald Ums" <Harald_Ums@hotmail.com> wrote in message
news:%23tDEIzZhGHA.4304@TK2MSFTNGP05.phx.gbl...
>I am doing:
> PS C:\> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName
>
> LastWriteTime FullName
> ------------- --------
> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\hosts
> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\lmho...
> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\netw...
> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\prot...
> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\serv...


Try:

ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName -wrap -auto

--
Keith


My System SpecsSystem Spec
Old 06-01-2006   #5 (permalink)
Harald Ums
Guest


 
 

Re: How do I get format-table to drop that omission points (...) and display my data

yes but now the output is wrapped in the file:
ls C:\WINDOWS\system32\drivers\etc | ft
CreationTime,LastWriteTime,LastAccessTime,FullName -wrap -auto >a.txt

Have a look at:
ls C:\WINDOWS\system32\drivers\etc | select
CreationTime,LastWriteTime,LastAccessTime,FullName | out-file a.txt

now powershell should know, that I am writing to a file ...

or look at:
ls C:\WINDOWS\system32\drivers\etc | select
CreationTime,LastWriteTime,LastAccessTime,FullName | out-string > a.txt

I looks to me as if the whole formatting subsystem in powershell assumes a
CONSOLE as default and not a textstream.

Only something like
ls C:\WINDOWS\system32\drivers\etc | foreach{ "{0,70} {1}" -F
$_.LastAccessTime,$_.FullName}

gives you a reliable output


"Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message
news:%23OzeACahGHA.1612@TK2MSFTNGP04.phx.gbl...
> "Harald Ums" <Harald_Ums@hotmail.com> wrote in message
> news:%23tDEIzZhGHA.4304@TK2MSFTNGP05.phx.gbl...
>>I am doing:
>> PS C:\> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName
>>
>> LastWriteTime FullName
>> ------------- --------
>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\hosts
>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\lmho...
>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\netw...
>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\prot...
>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\serv...

>
> Try:
>
> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName -wrap -auto
>
> --
> Keith
>



My System SpecsSystem Spec
Old 06-01-2006   #6 (permalink)
Keith Hill [MVP]
Guest


 
 

Re: How do I get format-table to drop that omission points (...) and display my data

"Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message
news:%23OzeACahGHA.1612@TK2MSFTNGP04.phx.gbl...
> "Harald Ums" <Harald_Ums@hotmail.com> wrote in message
> news:%23tDEIzZhGHA.4304@TK2MSFTNGP05.phx.gbl...
>>I am doing:
>> PS C:\> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName
>>
>> LastWriteTime FullName
>> ------------- --------
>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\hosts
>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\lmho...
>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\netw...
>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\prot...
>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\serv...

>
> Try:
>
> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName -wrap -auto
>


Skip that, it wraps on the column. Try this:

ls C:\WINDOWS\system32\drivers\etc |
ft -auto LastWriteTime,LastAccessTime ,FullName |
out-file -width 350 foo.txt

For some reason I thought that format-table had a "width" parameter but it
doesn't seem to in RC1R. I guess it just assumes the console width and
doesn't allow it to be changed. I guess it doesn't make sense considering
that format-table is meant for console output.

--
Keith


My System SpecsSystem Spec
Old 06-01-2006   #7 (permalink)
/\\/\\o\\/\\/
Guest


 
 

Re: How do I get format-table to drop that omission points (...)and display my data

Using csv format could also be an option for this kind of data :

ls C:\WINDOWS\system32\drivers\etc | select LastWriteTime,FullName |
out-csv -NoTypeInfo etc.csv

as csv is very suitable for tabledata.

also nice is that you can import it again

import-csv file.csv

gr /\/\o\/\/

Greetings /\/\o\/\/

Keith Hill [MVP] wrote:
> "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message
> news:%23OzeACahGHA.1612@TK2MSFTNGP04.phx.gbl...
>> "Harald Ums" <Harald_Ums@hotmail.com> wrote in message
>> news:%23tDEIzZhGHA.4304@TK2MSFTNGP05.phx.gbl...
>>> I am doing:
>>> PS C:\> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName
>>>
>>> LastWriteTime FullName
>>> ------------- --------
>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\hosts
>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\lmho...
>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\netw...
>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\prot...
>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\serv...

>> Try:
>>
>> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName -wrap -auto
>>

>
> Skip that, it wraps on the column. Try this:
>
> ls C:\WINDOWS\system32\drivers\etc |
> ft -auto LastWriteTime,LastAccessTime ,FullName |
> out-file -width 350 foo.txt
>
> For some reason I thought that format-table had a "width" parameter but it
> doesn't seem to in RC1R. I guess it just assumes the console width and
> doesn't allow it to be changed. I guess it doesn't make sense considering
> that format-table is meant for console output.
>
> --
> Keith
>
>

My System SpecsSystem Spec
Old 06-01-2006   #8 (permalink)
/\\/\\o\\/\\/
Guest


 
 

Re: How do I get format-table to drop that omission points (...)and display my data


/\/\o\/\/ wrote:
> Using csv format could also be an option for this kind of data :
>
> ls C:\WINDOWS\system32\drivers\etc | select LastWriteTime,FullName |
> out-csv -NoTypeInfo etc.csv
>
> as csv is very suitable for tabledata.
>
> also nice is that you can import it again
>
> import-csv file.csv
>
> gr /\/\o\/\/


export CSV it is :
ls C:\WINDOWS\system32\drivers\etc | select LastWriteTime,FullName |
export-csv -NoTypeInfo etc.csv

> Greetings /\/\o\/\/
>
> Keith Hill [MVP] wrote:
>> "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message
>> news:%23OzeACahGHA.1612@TK2MSFTNGP04.phx.gbl...
>>> "Harald Ums" <Harald_Ums@hotmail.com> wrote in message
>>> news:%23tDEIzZhGHA.4304@TK2MSFTNGP05.phx.gbl...
>>>> I am doing:
>>>> PS C:\> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName
>>>>
>>>> LastWriteTime FullName
>>>> ------------- --------
>>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\hosts
>>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\lmho...
>>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\netw...
>>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\prot...
>>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\serv...
>>> Try:
>>>
>>> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName -wrap
>>> -auto
>>>

>>
>> Skip that, it wraps on the column. Try this:
>>
>> ls C:\WINDOWS\system32\drivers\etc |
>> ft -auto LastWriteTime,LastAccessTime ,FullName |
>> out-file -width 350 foo.txt
>>
>> For some reason I thought that format-table had a "width" parameter
>> but it doesn't seem to in RC1R. I guess it just assumes the console
>> width and doesn't allow it to be changed. I guess it doesn't make
>> sense considering that format-table is meant for console output.
>>
>> --
>> Keith
>>

My System SpecsSystem Spec
Old 06-04-2006   #9 (permalink)
Alex K. Angelopoulos [MVP]
Guest


 
 

Re: How do I get format-table to drop that omission points (...) and display my data

This is also the easiest way to get clean list output (no leading/trailing
spaces, etc). You still occasionally get null data back, but blank lines are
a minor issue compared to table wraps.

PS> Get-WmiObject -Class Win32_UserAccount | Select-Object FullName |
Export-Csv -NoTypeInfo C:\temp\users.csv

"/\/\o\/\/" <no@spam.mow> wrote in message
news:OF85hTbhGHA.1276@TK2MSFTNGP03.phx.gbl...
>
> /\/\o\/\/ wrote:
>> Using csv format could also be an option for this kind of data :
>>
>> ls C:\WINDOWS\system32\drivers\etc | select LastWriteTime,FullName |
>> out-csv -NoTypeInfo etc.csv
>>
>> as csv is very suitable for tabledata.
>>
>> also nice is that you can import it again
>>
>> import-csv file.csv
>>
>> gr /\/\o\/\/

>
> export CSV it is :
> ls C:\WINDOWS\system32\drivers\etc | select LastWriteTime,FullName |
> export-csv -NoTypeInfo etc.csv
>
>> Greetings /\/\o\/\/
>>
>> Keith Hill [MVP] wrote:
>>> "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message
>>> news:%23OzeACahGHA.1612@TK2MSFTNGP04.phx.gbl...
>>>> "Harald Ums" <Harald_Ums@hotmail.com> wrote in message
>>>> news:%23tDEIzZhGHA.4304@TK2MSFTNGP05.phx.gbl...
>>>>> I am doing:
>>>>> PS C:\> ls C:\WINDOWS\system32\drivers\etc | ft LastWriteTime,FullName
>>>>>
>>>>> LastWriteTime FullName
>>>>> ------------- --------
>>>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\hosts
>>>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\lmho...
>>>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\netw...
>>>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\prot...
>>>>> 23.08.2001 14:00:00 C:\WINDOWS\system32\drivers\etc\serv...
>>>> Try:
>>>>
>>>> ls C:\WINDOWS\system32\drivers\etc | ft
>>>> LastWriteTime,FullName -wrap -auto
>>>>
>>>
>>> Skip that, it wraps on the column. Try this:
>>>
>>> ls C:\WINDOWS\system32\drivers\etc |
>>> ft -auto LastWriteTime,LastAccessTime ,FullName |
>>> out-file -width 350 foo.txt
>>>
>>> For some reason I thought that format-table had a "width" parameter but
>>> it doesn't seem to in RC1R. I guess it just assumes the console width
>>> and doesn't allow it to be changed. I guess it doesn't make sense
>>> considering that format-table is meant for console output.
>>>
>>> --
>>> Keith
>>>



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
-f format Format-Table Format-List against Select PowerShell
HTA file - display data from DB records in table like ASP - how? VB Script
RE: How to convert Table-Format Data to CSV-Format? PowerShell
RE: How to convert Table-Format Data to CSV-Format? PowerShell
RE: How to convert Table-Format Data to CSV-Format? PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46