Ini File to Registry Section


Ini2Reg

[ini-to-registry-section]
ini-file, ini-section, (ini-key), reg-root-string, subkey(,flags)

Moves lines or sections from an INI file to the registry, creating or replacing a registry entry under the given key in the registry.  The section name ini-to-registry-section must appear in an Ini2Reg item in an Install section of the INF file.

ini-file
Name of the INI file containing the key to copy.  For more information about specifying the INI filename, see the comments in the Reference topic about the Update Ini File Section.

ini-section
Name of the section in the INI file containing the key to copy.

ini-key
Name of the key in the INI file to copy to the registry.  If ini-key is empty the whole section is transferred to the specified registry key.

reg-root-string
Registry root name.  Can be one of these values:

subkey
Identifies the subkey to receive the value.  Has the form key1\key2\key3...

flags
Indicates whether to delete the INI key after transfer to the registry and whether to overwrite the value in the registry if the registry key already exists.  Can be one of these values:

ValueMeaning
0 (Default) Do not delete the INI entry from the INI file after moving the information in the entry to the registry. If the registry subkey already exists, do not replace its current value.
1 Delete the INI entry from the INI file after moving the information in the entry to the registry. If the registry subkey already exists, do not replace its current value
2Do not delete the INI entry from the INI file after moving the information in the entry to the registry. If the registry subkey already exists, replace its current value with the value from the INI file entry.
3 Delete the INI entry from the INI file after moving the information in the entry to the registry. If the registry subkey already exists, replace its current value with the value from the INI file entry.


For example, suppose the following entry exists in the WIN.INI file:

[Windows]
CursorBlinkRate=-1

If a CursorBlinkRate subkey does not exist under the Control Panel\Desktop, then the following item in an Ini File to Registry section creates the subkey, sets the value of the subkey to -1, and leaves the original line in WIN.INI unchanged:

win.ini,Windows,CursorBlinkRate,HKCU,"Control Panel\Desktop"

If the subkey already exists, the INF file item sets the value of the subkey to -1, and leaves the original line in WIN.INI unchanged.