@INIWRITE[file,section,entry,string]:  Creates, updates, or deletes an entry in the specified file. If file does not exist, it will be created. @INIWRITE returns 0 for success or -1 for failure.

 

File, section, and entry must be in quotes if they contain white space or special characters.

 

File selection

 

Both the name and extension of file must be specified. This function does not apply a default extension. If file does not explicitly include a path, @INIWRITE uses %Windir, the Windows installation directory. To use the current directory, you must explicitly specify it, e.g., using .\ as the path.

 

Action

 

If file does not exist, it will be created. If string is empty, file will be empty, otherwise a section line and a directive line will be created.

 

The remaining descriptions relate to the case when file exists.

 

If more than one match for section exists in file, only the first one is searched for entry. If more than one match exists for section and entry, only the first match is one is affected. Searching starts at the beginning of the file, and stops on the first match.

 

If string is empty, the matching entry, if any, is deleted. If string is not empty, and there is a matching section and entry, it is modified. If string is not empty, and there is no matching section and entry, it is created.

 

If entry is empty, the matching section (if any) is deleted.

 

Examples

 

echo %@iniwrite[c:\tcmd\tcmd.ini,TakeCommand,history,8192]

 

will set the size of the command history to 8,192 bytes.

 

echo %@iniwrite[c:\tcmd\tcmd.ini,TakeCommand,history,]

 

will remove the history entry from the file.