我有一个脚本几天前停止工作,当时它已经工作了三个月。该脚本从用户的本地驱动器运行,仅对少数用户失败。这两个弹出窗口都会显示,因此我知道源和目标都存在。奇怪的是,我在尝试找出这个问题时添加了最后一个if语句,并且该副本有效。有没有人见过这种情况?我在这里缺少什么?
set ws = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strLocalFolder = "C:\USERS\MyLocalFolder\"
strRemoteFile = "\\ServerName\RemoteFolder\test.dat"
If (objFSO.FileExists (strRemoteFile )) Then
ws.Popup "Found file " & strRemoteFile
End If
If (objFSO.FolderExists(strLocalFolder )) Then
ws.Popup "Found folder " & strLocalFolder
End If
objFSO.CopyFile strRemoteFile, strLocalFolder, True
If (objFSO.FolderExists(strLocalFolder )) Then
objFSO.CopyFile strRemoteFile, strLocalFolder, True
End If