用批处理文件读取简单的配置文件

Let's say, configuration list in config.ini is as:

abc=abc
a=a
localpath=D:\local\path

 To read the key-value, we create a test.bat:

@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%i in ('type "config.ini"^| find /i "="') do set %%i
echo %a%
echo %abc%
echo %localpath%

Drop config.ini and test.bat to the same folder then run test.bat from command prompt you'll see the result.

 

posted @ 2015-04-17 06:47  维博.WILBUR  阅读(2573)  评论(0编辑  收藏  举报