0
我试图在我的网站的文件夹结构中使用Microsoft.XmlHttp
获取文件内的文本,然后在本地PC上将其与我的version.txt
进行比较。如果相同,它会提示消息说它包含相同的版本,否则它会显示相反的消息。从服务器获取响应文本
URL="http://www.example.org/sites/default/files/version.txt"
Set WshShell = WScript.CreateObject("WScript.Shell")
Set http = CreateObject("Microsoft.XmlHttp")
On Error Resume Next
http.open "GET", URL, False
http.send ""
if http.status = 200 Then
server_version = http.responseText
End if
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objClientVersion = objFSO.OpenTextFile("C:\mcgfiles\avp\hash.txt",1)
client_version = objClientVersion.ReadLine
comparison = StrComp(server_version, client_version)
If comparison = 0 Then
Wscript.Echo "the same"
Else
Wscript.Echo "not the same"
End If
有点儿工作,但每次我试图改变http://www.example.org/sites/default/files/version.txt从我的服务器中的内容,该脚本仍然得到旧值:例如,http://www.example.org/sites/default/files/version.txt之前为123456,当我运行的值脚本它得到123456当我的值更改为654321,并运行此脚本,它仍然得到旧值是123456帮助谢谢