Command Prompt for Windows




GETINI Example

Consider the following batch file :-

@ECHO OFF
IF "%1"=="" { 
	COLOUR error
	ECHO Section name not specified
	STOP
}
GETINI %1 "" %2
IF "%getini%"=="" {
	COLOUR error
	ECHO Section not found
	STOP
}
FOR %%i IN (%getini%) DO {
	SAY %%i=
	GETINI %1 %%i %2

	REM Must use SAY to print %getini% since we can not
	REM be sure that %getini% will not contain the word
	REM 'off',  which has a special meaning for command
	REM ECHO.

	SAY %getini%
	ECHO.
}

This batch file demonstrates the use of command GETINI to display all the key names along with their values for the specified section and initialisation file. The section and initialisation file are specified as the first and second parameters, respectively, when running the batch file.