8.5.2 IniWrite (enter a value in an initialization file)
- Purpose
-
Enters a value in an initialization file (.INI file).
- Syntax
IniWrite (FilePath, SectionName, EntryName, Value)
- Arguments
-
- FilePath
-
Write the full path of the initialization file as a character string or as a variable that stores this value.
- SectionName
-
Write a section name as a character string or as a variable that stores this value.
- EntryName
-
Write an entry name as a string, number, or as a variable that stores this value.
- Value
-
Specify the value to set in this entry as a string, number, or as a variable that stores this value.
- Description
-
The IniWrite command enters a value in a specific section of the specified initialization file. The command returns True on successful execution, or False if an error occurs.
If the specified initialization file does not exist, a new file is created. If the specified section does not exist, a new section is created.
- Notes
-
-
Take care when specifying an initialization file in the folder set in the environment variable ProgramFiles (normally the Program Files folder on the system drive) or WinDir (normally the Windows folder on the system drive). For details, see 1.8.3 Effect of the executing user on command behavior.
-
You can configure access permissions when creating an initialization file. In the following registry key, set the access permissions beforehand:
- Registry key
-
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Hitachi\JP1/Script\SPTX\Option
- Value name
-
SecurityAttributesSucceed
- Value datatype
-
REG_DWORD
- Value
-
0: Access permissions are not set.
1: Access permissions are set to "Inherit access permissions from parent folders".
2: Access permissions are set to "Everyone: Full control".
If no value is set, or a value other than those above is set, the setting defaults to 0.
- When the setting takes effect
-
The setting takes effect the next time the script file is executed.
-
- Example
-
The script below enters data in the initialization file ABC.INI in the Windows folder.
' Script file IniWrite (_WIN_+"ABC.INI", "Files", "File01", "Readme.txt") IniWrite (_WIN_+"ABC.INI", "Files", "File02", "Abc.exe") ; ABC.INI [Files] File01 = Readme.txt File02 = Abc.exe
- JP1/Script version
-
Supported from JP1/Script 01-00.