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

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

abc=abc
a=a
localpath=D:localpath

 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.

原文地址:https://www.cnblogs.com/urwlcm/p/4433871.html