0
我有下面的VBScriptVBScript中的文件系統問題
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 ad b.pdf,它只下載其中的一個。 如果我註釋掉上面提到的這一行,它會成功下載所有文件。什麼是問題?