INI file
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: INI file
I am looking at this and I don't know if I am reading it right but this just reads the INI file and output it to as a hash. I just want to add a section to an existing ini file without damaging it.
Re: INI file
I have to do it to multiple files and worried if I just add I will break the ini file in some way.
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: INI file
It's just a text file. You can't be afraid of the wind. Just iterate through your files and append the section you want to the end. Probably want to make sure you add a CR/LF before adding your stuff.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: INI file
Easiest way is:
All else will be taken care of automatically
Code: Select all
$section = @'
item1=text1
item2=text2
item3=text2
'@
$section | Out-File file.ini -Append