Hello Scripters,
I have found a good reading on how to edit a .ini file but what I wanted to
do instead of editing the .ini File, I would like to add a line via
scripting. Help! I need a script that can add line on a .ini file.
Thanks,
GP

Re: adding a line to .ini file by James

James
Thu May 08 18:12:45 CDT 2008

"GYIPT" <GYIPT@discussions.microsoft.com> wrote in message
news:B0601C1A-E607-40F3-AD3F-24CA0CD1D376@microsoft.com...
> Hello Scripters,
> I have found a good reading on how to edit a .ini file but what I wanted
> to
> do instead of editing the .ini File, I would like to add a line via
> scripting. Help! I need a script that can add line on a .ini file.

If you simply want to append to the bottom, you could use something like
this:

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set oFSO = CreateObject("Scripting.FileSystemObject")

With oFSO.OpenTextFile("C:\MyINI.ini", 8)
.WriteLine "NewSetting=NewValue"
End With
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~