---line.vbs---
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile ("a.txt", ForReading)
Do Until objTextFile.AtEndOfStream
strComputer = objTextFile.ReadLine
Wscript.Echo strComputer
Loop
objTextFile.Close
---change.vbs---
'定义所用的变量
Dim fso,file,text1,text2,file0,content
Set fso=CreateObject("scripting.filesystemobject")
'防止出错
On Error Resume Next
file = InputBox ("请你输入文本的路径","方窗制作")
text1 = InputBox ("请输入要替换的字节","方窗制作")
text2 = InputBox ("请输入替换后的字节","方窗制作")
Set file0 = fso.Opentextfile(file, 1, false)
content = file0.readall
'替换字节函数
Function ReplaceTest(text, patrn, replStr)
Dim regEx, str1 '建立函数变量
str1 = text '要更改的文本字段
Set regEx = New RegExp '建立正则表达式
regEx.Pattern = patrn '设置要替换的字符
regEx.IgnoreCase = True '设置是否区分大小写
ReplaceTest = regEx.Replace(str1, replStr) '作替换
End Function
'写出文本函数
Function Writetext(text)
Set text0= fso.openTextFile(file&"已替换.txt",2,true)
text0.writeline text
End Function
'同时调用双函数
Writetext(ReplaceTest(content,text1,text2))
MsgBox "恭喜你已经替换成功",,"方窗制作"
[ Last edited by wenquan on 2009-9-13 at 09:31 ]作者: wenquan 时间: 2009-9-14 01:03 大哥們,幫忙看看呀,沒有頂,自己看頂一下。作者: wenquan 时间: 2009-9-15 10:05 大哥們幫忙看看呀,謝謝!