Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Change encoding of file

$
0
0

Hi All,

I would like to be able to change the encoding of a file from UTF-8 to Unicode in powershell.  I can do it no problem in notepad by going to Save as however, i'm not too sure how to do this in powershell.  I've tried this:

(Get-Content -Encoding UTF8 $FILENAME ) | Out-File -Encoding Unicode $FILENAME

But it takes a lot longer to run this command than it does to do a Save as.  Most likely because the notepad way is changing some king of signature whereas powershell is reading and converting the file.  So is it possible to mimic what the Save as option does with notepad in powershell? 

Many Thanks for any ideas,

Slash.


Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>