View Single Post
Old 05-16-2008   #2 (permalink)
Karl Mitschke


 
 

Re: Files created by Powershell are over 2X bigger than files created by text editor or cmd.exe.

Hello tom,

It's not outputting in ASCII. (I beleive it's unicode)

Do this:

"test" |out-file -Encoding ascii test.c

Karl
Quote:

> I'm trying to build telnet scripts using Powershell and run them with
> the Telnet Script Tool (TST) but files created by Powershell are not
> recognized as valid text/script files by TST.
>
> I discovered files generated by Powershell are more than twice the
> size of plain text files created outside of Powershell.
>
> Here is the test:
> [PowerShell]
> "test"> test.a
> [Cmd.exe]
> echo test> test.b
> A 'dir' of these files from a shell reveals:
> 05/16/2008 09:34 AM 14 test.a
> 05/16/2008 09:34 AM 6 test.b
> *Notice the size of the files.
>
> What's going on? The test.b file is appropriately 6 bytes: "test\r\n"
> = 6 chars. Where are the extra 8 chars coming from in the PS-created
> file?
>
> The files in any text editor appear identical and Textpad said they
> were identical as well.
>
> Then I opened a PS-created file in MS Word 2007 and saw non-printable
> chars before each char in the file.
>
> Please help. Thx.
>

My System SpecsSystem Spec