Originally posted by yangzhiyi at 2007-3-17 07:52 AM:
还差一个参数没有啊,应该还有一个功能能读出项目的数值 如
timeout=3
得到 3
现在
inifile c:\boot.ini "" timeout
:: 显示 ...
=================================
可以在下面添加下面代码
for /f "delims=;" %%x in ("%%i=%%j") do (
if not DEFINED item (echo %%x) else (
setlocal EnableDelayedExpansion
call :trim a
if /i "!a!"=="%item%" (
if "%setvar%"=="1" (
endlocal&set "%%x"
) else (
call :item_v " %%x"
rem endlocal&echo %%x
)
)
)
)
:item_v
set a=%1
endlocal&echo %a:~6,1% //这里要取多少个值你可以自己设置 或再加点代码来自动取值.....
goto :eof
Originally posted by yangzhiyi at 2007-3-17 07:52 AM:
There is still one parameter missing. There should be a function to read the value of the item, such as
timeout=3
get 3
Now
inifile c:\boot.ini "" timeout
:: display ...
=================================
You can add the following code below
for /f "delims=;" %%x in ("%%i=%%j") do (
if not DEFINED item (echo %%x) else (
setlocal EnableDelayedExpansion
call :trim a
if /i "!a!"=="%item%" (
if "%setvar%"=="1" (
endlocal&set "%%x"
) else (
call :item_v " %%x"
rem endlocal&echo %%x
)
)
)
)
:item_v
set a=%1
endlocal&echo %a:~6,1% //Here you can set how many values to take by yourself or add more code to get values automatically.....
goto :eof