powershell - Convert text file to ANSI format -


i running 2 powershell scripts. 1 powershell script adds host name text file. other powershell script appends ip address of machine same file. so, .txt file looks follows: hostname ipaddress but, file being saved in unicode format default. can that, text file stored in ansi format?

i use powershell v2.0.

[system.text.encoding]::default   issinglebyte : true bodyname : iso-8859-1  encodingname : western european (windows)  headername : windows-1252  webname : windows-1252 windowscodepage : 1252 isbrowserdisplay : true isbrowsersave : true ismailnewsdisplay : true ismailnewssave : true encoderfallback : system.text.internalencoderbestfitfallback decoderfallback : system.text.internaldecoderbestfitfallback isreadonly : true  codepage : 1252  

depending on how outputting text may need set encoding type. using out-file -encoding use type of ascii. depends on version of powershell you're using.

see: ss64 out-file , set encoding ansi in powershell 2.0


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -