请帮忙解释下这句代码?

来源:百度知道 编辑:UC知道 时间:2024/05/16 14:17:49
是个读取文件并且修改某文件内容的程序语句,但我很多地方看不明白呀,请高人给注释下,多谢

Set good = Server.CreateObject("Scripting.FileSystemObject")
Set user = good.OpenTextFile(path,1)
userall=user.ReadAll
userall=replace(userall,"this_user_name",user_1)
userall=replace(userall,"this_user_name",user_2)

set good=nothing
Set name = good.OpenTextFile(path,2,True)
name.Write userall
set name=nothing

//创建文件系统对象
Set good = Server.CreateObject("Scripting.FileSystemObject")
//用文件系统对象以读取方式打开path指定的文本文件
Set user = good.OpenTextFile(path,1)
//读取文件全部内容到内存中的userall变量
userall=user.ReadAll
//替换userall变量,用user_1替换this_user_name
userall=replace(userall,"this_user_name",user_1)
//此语句无用,因为已经不存在this_user_name
userall=replace(userall,"this_user_name",user_2)
//关闭文件系统对象所打开的文件
set good=nothing
//写入方式打开同一文件
Set name = good.OpenTextFile(path,2,True)
//将修改过的userall变量写到文件中
name.Write userall
//关闭文件
set name=nothing

Set good = Server.CreateObject("Scripting.FileSystemObject") '建立文件操作对象
Set user = good.OpenTextFile(path,1) '打开指定path 的文件
userall=user.ReadAll '读取path文件所有内容到userall变量
userall=replace(userall,"this_user_name",user_1) ‘替换 文件内容 里 "this_user_name"为 user_1
userall=replace(userall,"this_user_name"