我有一个文件build.properties,内容如下 - # $DateTime: 2010/03/26 17:56:36 $ $Change: 93719 $ $Author: xxx $
- ##################################################
- # DIRECTORY PROPERTIES (that supersede those in build.xml
- ##################################################
- # should be the absolute path to the current dir
- BUILDTOOLS=/change/this/value
- # should be the absolute path to the parent of the app build dir
- BUILDROOT=/change/this/value
- # should be the absolute path to the parent of the app build dir
- DIR_NAME=proddev
- #eof
复制代码现在我想去修改其中的某项值,比如将BUILDTOOLS=后的/change/this/value修改成D:\Code\dev\BuildUtil,
BUILDROOT=后的/change/this/value修改成D:\Code\dev,其他原样输出。然后输出为config.ini文件
我看了一些介绍,自己写了一个,如下 - @echo off&&setlocal enabledelayedexpansion
- set n=0
- set DevPath=D:\Code\dev
- set FilePath=%DevPath%\BuildUtil
- for /f "delims== tokens=1,2" %%i in (build.properties) do (
- if !n! equ 0 (>config.ini echo %%i %%j) else (
- if %%i equ BUILDTOOLS (>>config.ini echo %%i=%FilePath%) else (
- if %%i equ BUILDROOT (>>config.ini echo %%i=%DevPath%) else (>>config.ini echo %%i=%%j)))
- set/a n+=1
- )
复制代码
但是生成的config.ini文件中有一些多余的=(等于号),我就不知道怎么修改了,请帮忙修改下,或者能实现同样的功能。
谢谢了。
[ 本帖最后由 michael_hy 于 2010-4-15 16:28 编辑 ] |