本帖最后由 yhcfsr 于 2018-7-7 13:59 编辑
- @echo off
- set "IniFile=d:\test\setup.ini"
- if not exist "%IniFile%" call :CreateIniFile
-
- for /f "delims=" %%a in ('type "%IniFile%"^
- |findstr /ri "server_ip server_port"') do set "%%a"
- echo;server_ip变量值:%server_ip%
- echo;server_port变量值:%server_port%
- pause&exit
-
- :CreateIniFile
- >%IniFile% echo;[config]
- set/p "server_ip=server_ip="
- >>%IniFile% echo;server_ip=%server_ip%
- set/p "server_port=server_port="
- >>%IniFile% echo;server_port=%server_port%
- goto:eof
复制代码
|