# creating cfg file with odd results

**URL:** <https://forums.powershell.org/t/creating-cfg-file-with-odd-results/4670>\
**Category:** PowerShell Help\
**Created:** [August 11, 2015, 1:37pm UTC](https://forums.powershell.org/t/creating-cfg-file-with-odd-results/4670 "2015-08-11T13:37:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shane-lindberg](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@shane-lindberg](https://forums.powershell.org/u/shane-lindberg)\
**Post date:** [August 11, 2015, 1:37pm UTC](https://forums.powershell.org/t/creating-cfg-file-with-odd-results/4670/1 "2015-08-11T13:37:11Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bobmccoy](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/bobmccoy/32/650_2.png) [@bobmccoy](https://forums.powershell.org/u/bobmccoy)\
**Post date:** [August 11, 2015, 7:55pm UTC](https://forums.powershell.org/t/creating-cfg-file-with-odd-results/4670/2 "2015-08-11T19:55:46Z")

</div>

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.
```

---

<div class="post-metadata">

**Author:** ![shane-lindberg](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@shane-lindberg](https://forums.powershell.org/u/shane-lindberg)\
**Post date:** [August 12, 2015, 1:17pm UTC](https://forums.powershell.org/t/creating-cfg-file-with-odd-results/4670/3 "2015-08-12T13:17:45Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:44pm UTC](https://forums.powershell.org/t/creating-cfg-file-with-odd-results/4670/4 "2024-05-16T20:44:57Z")

</div>


