请教:修改a.cfg里update的参数,应该怎么实现
本帖最后由 yxiaopeng 于 2010-12-24 14:25 编辑D:\jxsoft\a.cfg内容如下
ServerIP=192.168.0.201
update=1
TimeStemp=300
怎么才能让update=3
请改个完全的源码。谢谢! 各位帮忙看看应该怎么做啊? 本帖最后由 lainline 于 2010-12-24 19:18 编辑
#include <Array.au3>
$filetext=FileRead("D:\Djxsoft\a.cfg")
$filetext =StringReplace($filetext,@CRLF,"_CRLF_")
$S =StringSplit ( $filetext, "_CRLF_update=" ,3)
$T=StringSplit( $S,"_CRLF_",3)
$T="update=3"
$S=_ArrayToString ($T,@CRLF)
$filetext=_ArrayToString ($S,@CRLF)
$filetext =StringReplace($filetext,"_CRLF_",@CRLF)
$hfile=FileOpen("D:\Djxsoft\a.cfg",2)
FileWrite ($hfile ,$filetext)
FileClose($hfile)也可用@CRLF分数组 再用数组搜索 $NAME="D:\Djxsoft\a.cfg"
$hfile=FileOpen($NAME,0)
$filetext=FileRead($hfile)
$filetext=""&@CRLF&$filetext
$hfile=FileOpen($NAME,2)
FileWrite($hfile,$filetext)
FileClose($hfile)
IniWrite ($NAME, "xxx", "update", "3" )
$hfile=FileOpen($NAME,0)
$filetext=FileRead($hfile)
$filetext=StringReplace($filetext,""&@CRLF,"")
$hfile=FileOpen($NAME,2)
FileWrite($hfile,$filetext)
FileClose($hfile) 楼上正解,呵呵
页:
[1]