Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Writing to a file with out-file or export-csv

Closed Thread
 
Thread Tools Display Modes
Old 11-07-2006   #1 (permalink)
Marco Shaw
Guest


 

Writing to a file with out-file or export-csv

OK, pretty basic probably. Yes, I'm new to PSH, like us all! ;-)

Why doesn't this work?

PS C:\> gc test.1
1
2
PS C:\> for ($i=0;$i -lt $string.count;$i+=1) {$string[$i]}
1
2
PS C:\> for ($i=0;$i -lt $string.count;$i+=1) {$string[$i]}|out-file test.2
An empty pipe element is not permitted.
At line:1 char:53
+ for ($i=0;$i -lt $string.count;$i+=1) {$string[$i]}|o <<<< ut-file test.2


Old 11-07-2006   #2 (permalink)
dreeschkind
Guest


 

RE: Writing to a file with out-file or export-csv

I think this has been discussed not long ago somewhere here.

Afaik it was just a design decision.
Try this:

$( for ($i=0;$i -lt $string.count;$i+=1) {$string[$i]} ) |
out-file test.2

--
greetings
dreeschkind

"Marco Shaw" wrote:

> OK, pretty basic probably. Yes, I'm new to PSH, like us all! ;-)
>
> Why doesn't this work?
>
> PS C:\> gc test.1
> 1
> 2
> PS C:\> for ($i=0;$i -lt $string.count;$i+=1) {$string[$i]}
> 1
> 2
> PS C:\> for ($i=0;$i -lt $string.count;$i+=1) {$string[$i]}|out-file test.2
> An empty pipe element is not permitted.
> At line:1 char:53
> + for ($i=0;$i -lt $string.count;$i+=1) {$string[$i]}|o <<<< ut-file test.2
>
>
>

Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
writing out to file Braden C. Roberson-Mailloux PowerShell 3 05-18-2008 01:12 PM
Re: Writing output to a formatted file Keith Hill [MVP] PowerShell 0 11-08-2007 08:49 PM
out-file not writing ERROR's and WARNING's into the log ThorstenK PowerShell 9 08-13-2007 07:23 PM
Newbie - Writing to host and a text file FreddieF PowerShell 5 02-16-2007 11:03 AM
writing output to XML file Nikhil R. Bhandari PowerShell 0 02-15-2007 07:40 AM








Vistax64.com 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 2005-2008

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 47 48 49 50