I was trying to make a config file to alter a programs behavior
when I created the file using this method. the file size was twice as large as the next method.
"UpdateDisable=1" > file.cfg "UpdateEnable=0" >> file.cfg
when I used this method, the file size was half as large as the first method
Add-Content file.cfg "UpdateDisable=1" Add-Content file.cfg "UpdateEnable=0"
the files seemed the same, but only the second file actually worked as it was supposed to(changed the update settings). Was this because of the difference in size or some other subtle difference in the file structure or how the file was created?
It's the difference between a Unicode file and an ASCII file. Many output cmdlets use the -Encoding parameter to allow you to explicitly declare the type of output.
From Get-Help about_redirection ...
When you are writing to files, the redirection operators use Unicode encoding. If the file has a different encoding, the output might not be formatted correctly. To redirect content to non-Unicode files, use the Out-File cmdlet with its Encoding parameter.
You must be logged in to reply to this topic.