我的问题是如何用Windows命令行解析ini文件。
我在尝试从文件中删除一个带有所有键的部分时被卡住了。此节的名称已知并保存在变量中。
我试着节省线(开始,结束),以删除之间的东西,但它没有对我起作用。
这里有人能帮我吗?
编辑:
下面是一个ini文件示例:
[Example]
cycle = value
cycle2 = value
cycle_bu = value
[Example2]
key1 = value
key2 = value
key3 = value
key4 = value
[something3]
key1 = value
key2 = value
key3 = value
key4 = value
key5 = value
key6 = value发布于 2012-11-30 14:57:53
nt
你能检查一下这个是否能胜任这项工作吗?
编辑:--没有经过测试:
break >new.ini
set skip_this_section=[something]
set skip_flag=0
for /f %%I in (myini.ini) do (
call :print_to_file %%I
)
goto :eif
:print_to_file
setlocal enabledelayedexpansion
set line=%1
set first_char=!line:~0,1!
if "!first_char!" EQU "[" (
if "!line!" EQU "!skip_this_section!" (
set skip_flag=1
) else (
set skip_flag=0
)
)
endlocal & set skip_flag=%skip_flag%
if %skip_flag% EQU %0% (
echo %1 >> new.ini
) 发布于 2019-08-12 14:37:26
有一个CLI crudini按组和键操作ini条目:
https://stackoverflow.com/questions/13646498
复制相似问题