Table of Contents

About

How to parse a property file in DOS with the F option of the FOR loop.

Snippet

# Comments
myHostName=gerardnico.local
myPort=1521

Dos Script to list the content

:: The lines beginning with # will be skipped
FOR /F "tokens=1,2* delims== eol=# " %%i in ('type "path to\file.properties"') do (
	@echo i = %%i 
	@echo j = %%j
	)
i = myHostName
j = gerardnico.local
i = myPort
j = 1521

Conditional processing with a if statement:

FOR /F "tokens=1,2* delims== eol=# " %%i in ('type "path to\file.properties"') do (
	if "%%i" == "myHostName" @echo    - My Host Name is  %%j 
	if "%%i" == "myPort" @echo    - My Port is  %%j 
	)
- My Host Name is  gerardnico.local
   - My Port is  1521