IniDelete

Deletes a value from a standard format .ini file.

IniDelete Filename, Section , Key

Parameters

Filename

Type: String

The name of the .ini file, which is assumed to be in A_WorkingDir if an absolute path isn't specified.

Section

Type: String

The section name in the .ini file, which is the heading phrase that appears in square brackets (do not include the brackets in this parameter).

Key

Type: String

If omitted, the entire section will be deleted. Otherwise, specify the key name in the .ini file.

Error Handling

An OSError is thrown on failure. On Linux and macOS, this includes unreadable files and symbolic-link cycles; a missing file has no effect.

Regardless of whether an exception is thrown, A_LastError is set to the result of the operating system's GetLastError() function.

Remarks

A standard ini file looks like:

[SectionName]
Key=Value

Linux and macOS

The file is replaced atomically, preserving unaffected content, encoding, line endings and permissions. A symbolic link to the file is preserved while its target is updated.

IniRead, IniWrite, RegDelete, RegDeleteKey

Examples

Deletes a key and its value located in section2 from a standard format .ini file.

IniDelete "C:\Temp\myfile.ini", "section2", "key"