我有以下 vbscript
Set colNamedArguments = WScript.Arguments.Named
dim logFSO, logFile
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set logFSO = CreateObject("Scripting.FileSystemObject")
>>>> 'Set logFile = logFSO.OpenTextFile("a.log", ForAppending, True)
strFileURL = <passed from batch script>
strHDLocation = <passed from batch script>
WebUser = "user"
WebPass = "pwd"
Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
'objXMLHTTP.open "GET", strFileURL, false
objXMLHTTP.open "GET", strFileURL, false, WebUser, WebPass
objXMLHTTP.send()
If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject("ADODB.Stream")
objADOStream.Open
objADOStream.Type = 1 'adTypeBinary
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0 'Set the stream position to the start
'Set objFSO = Createobject("Scripting.FileSystemObject")
' If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
'Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if
Set objXMLHTTP = Nothing
我从批处理脚本循环调用脚本,如果以 >>>> 开头的行被注释,则一切正常,如果未注释,则只下载一个文件。例如,如果我调用它两次来下载 a.pdf 和 b.pdf,它只会下载其中一个。如果我注释掉上面提到的行,它会成功下载所有文件。问题是什么?