Hi Guys,

The issue is I want to edit a INI file using VBScript.

There is a INI file with many sections i.e.[], I want to enter a single line at the end of a perticular section

e.g.

INIfile

[Test]
hasbcb
jhbc
[Telnet3270]
sjhgfj
[Menu]
mnbf

Now I amt to add a line "This is a test script " at the end of section [Telnet3270].

End of the section can be also identify a begining of new section i.e. "["

How I can do this using a VBScript?
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Check out the INI file class on JSWare.net http://www.jsware.net. It's easy to use and reliable. It'll save having to endure the mess of looping through the entire file looking for the section name string, then finding the last entry for that section, etc., etc.

Don't be put off by the scary word "class". Really, it's just a shorthand way of referring to and using a bunch of properties and functions. You just take it on to the end of your script file, declare a variable, set that variable as a 'New' object of that class, then start using its functions (more correctly, methods) and properties. There are examples.
Answered 06/08/2009 by: VBScab
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity