dim read1,read2,file1,file2
file1="a.txt" 'a.txt
file2="b.txt" 'b.txt,注意引号不能去掉,
set shell=createobject("wscript.shell")
set open=createobject("scripting.filesystemobject")
public function written(byval text,byval writt,byval line,byval col)
for each i in split(text,vbcrlf)
j=j+1
if j=line then
if col=-1 then written=written&left(i,len(i))&writt&vbcrlf else written=written&mid(i,1,col)&writt&mid(i,col+1,len(i))&vbcrlf
else
written=written&i&vbcrlf
end if
next
written=trimt(written)
end function
Public Function TrimT(ByVal Text)
If Right(Text, 2) = vbcrlf Then TrimT = Left(Text, Len(Text) - 2)
End Function
read1=open.opentextfile(file2).readall
read2=open.opentextfile(file1).readall
open.createtextfile(file2).write written(read1,read2,8,-1)
'保存为vbs类型文件
'-----------
'已修改
追问最好不要新建文件,就在源文件修改
追答没有新建文件修改的就是B.txt 你自己好好检查一下?
追问新建了new,txt
b,txt内容没改变。
谢谢
请指点
追答我无语了 我刚修改了代码 你难道没有复制吗?
open.createtextfile(file2).write written(read1,read2,8,-1)
我把"new.txt" 修改为file2了
你脑袋秀逗了?
追问不好意思,秀逗了一下,那能不能把第8行往下移,
不要改变第8行