$GETPROFILEDATA (get Windows initialization file data)
$GETPROFILEDATA reads all keys and values in the specified section of the specified Windows initialization file name into an array variable. The keys in the section are stored as array key values.
Syntax
$GETPROFILEDATA(Windows-initialization-file-name,section-name,array-name)
Values
-
Windows-initialization-file-name
Specifies the name of the Windows initialization file to be read. Specify the file name as either a constant or a variable. A constant must be enclosed in single quotation marks ('').
The Windows initialization file is stored in Asset-Console-installation-folder\env.
-
section-name
Specifies the name of the section to be acquired. Specify the section name as either a constant or a variable. A constant must be enclosed in single quotation marks ('').
If section-name is a 0-byte character string, this function stores all section names of the Windows initialization file in a key array. When this happens, the key values are not stored in the array.
-
array-name
Specifies the variable name of the array into which information from the Windows initialization file is read.
Status
The following table lists and describes the possible statuses:
Status |
Description |
---|---|
NORMAL |
Normal end |
NODATA |
Indicates one of the following:
|
ERROR |
— |
Script execution interrupted |
An invalid argument was specified, or an error other than the above occurred. |
Example
The following example acquires values from the section TITLE and the key name HardwareInfo from the Windows initialization file Sample.ini:
[SET_VALUE] FILENAME = 'Sample.ini' SECTION = 'TITLE' $GETPROFILEDATA(FILENAME, SECTION, ARY) VAL=$GETARRAYBYKEY(ARY, 'HardwareInfo') MSG = 'HardwareInfo = ' + VAL $ECHO(MSG)
Sample.ini file
[TITLE] AssetInfo = Asset Information HardwareInfo = Hardware Information SoftwareInfo = Software Information
- Execution result:
-
HardwareInfo = Hardware Information