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

redirect unicode format output

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 10-12-2006   #1 (permalink)
hn
Guest


 

redirect unicode format output

from powershell windows I entered this command:
cmd /c "dir > $env:temp\xxx.txt"
the output file xxx.txt is in ascii format. But if I entered this command
instead:
cmd /c dir > $env:temp\xxx.txt
(without double quote) xxx.txt is in unicode format.

Can someone give me an explanation?

Thanks.

My System SpecsSystem Spec
Old 10-12-2006   #2 (permalink)
Roman Kuzmin
Guest


 

Re: redirect unicode format output

"hn" <hn@discussions.microsoft.com> wrote:
> cmd /c "dir > $env:temp\xxx.txt"
> cmd /c dir > $env:temp\xxx.txt


My guess is that:

*) in the first case redirection to a file is done by cmd (i.e. PowerShell
runs cmd; cmd runs dir and redirects its output to a file in ASCII encoding,
then PowerShell does nothing having no cmd output);

*) in the second case redirection to a file is done by PowerShell (i.e.
PowerShell runs cmd; cmd runs dir and sends output to the standard output
stream, then PowerShell redirects this cmd output to a file in Unicode
encoding).

--
Thanks,
Roman


My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I redirect output from Invoke-Expression ? David Kriz PowerShell 3 05-30-2008 09:53 PM
Re: -f output to file is unicode Oisin Grehan PowerShell 0 12-11-2007 09:08 AM
Better HTML-ized output to file unicode/ascii thing cccstar PowerShell 1 12-20-2006 11:59 AM
ansi versus unicode output with redirection operators? klumsy@xtra.co.nz PowerShell 10 12-02-2006 11:25 PM
how to redirect whatif output to a file? gaindev PowerShell 11 10-11-2006 12:57 PM


Update your Vista Drivers Update Your Drivers Now!!

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