Method Reference (COM)

IniWrite

Writes a value to a standard format .ini file.

IniWrite "filename", "section", "key", "value"

 

Parameters

filename The filename of the .ini file.
section The section name in the .ini file.
key The key name in the in the .ini file.
value The value to write/change.

 

Return Value

Success: Returns 1.
Failure: Returns 0 if file is read-only.

 

Remarks

A standard ini file looks like:
[SectionName]
Key=Value

If file does not exist, it is created. Keys and/or sections are added to the end and are not sorted in any way.

 

Related

IniDelete, IniRead, FileWriteLine

 

Example

Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
oAutoIt.IniWrite "C:\Temp\myfile.ini", "section2", "key", "this is a new value"