怎么使用批处理命令获取ini文件的部分参数,并存为一个新的ini文件
old.ini中有:[111]content1=aaaaaaconrent2=bbbbbb[222]content3=cccccccontent4=dddddd[333]...
old.ini中有:
[111]
content1=aaaaaa
conrent2=bbbbbb
[222]
content3=cccccc
content4=dddddd
[333]
content5=eeeeee
content6=ffffff
需要用批处理命令获取其中的一些参数,并存为新的ini文件new.ini
[111]
content1=aaaaaa
[222]
content4=dddddd
[333]
content6=ffffff 展开
[111]
content1=aaaaaa
conrent2=bbbbbb
[222]
content3=cccccc
content4=dddddd
[333]
content5=eeeeee
content6=ffffff
需要用批处理命令获取其中的一些参数,并存为新的ini文件new.ini
[111]
content1=aaaaaa
[222]
content4=dddddd
[333]
content6=ffffff 展开
展开全部
@echo off & color 0e & title GAGATOSHUT
setlocal enabledelayedexpansion
(for /f "eol= delims=" %%i in (old.ini) do (
set a=%%i
if "!a:~0,8!"=="content1" (
echo !a!)
))>>new.ini
(for /f "eol= delims=" %%i in (old.ini) do (
set a=%%i
if "!a:~0,8!"=="content4" (
echo !a!)
))>>new.ini
(for /f "eol= delims=" %%i in (old.ini) do (
set a=%%i
if "!a:~0,8!"=="content6" (
echo !a!)
))>>new.ini
echo 已提取完成. & pause>NUL
::GAGATOSHUT团队
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询