我是VB脚本的新手,遇到了问题。我一直在
错误:未找到路径
代码:800A004C
运行脚本时;
Set objMachineList = objFSO.OpenTextFile(txtMachineList, ForReading)
如果我将其更改为本地文件夹,我不再收到错误,但需要访问网络驱动器才能使脚本正常工作。现在是时候了解背景故事。有一台主机安装有网络驱动器的程序(称为TOMART,是带有GUI界面的PDF技术文档),有多台计算机访问驱动器(在线或始终可脱机)以进行同步,工作良好。但是,所述程序的更新需要安装到每个联网计算机硬盘驱动器中,以便集成并应用更新以供程序使用。问题是,更新需要传输到每个计算机硬盘驱动器,以便程序识别它并且没有脚本正常工作,更新不会转移到每个计算机硬盘驱动器,因此在访问程序中更新的PDF时,程序只是抛出错误代码。我附上了整个剧本,希望有人可以帮助我。
如果我对任何事情都不清楚,请提前告知长篇啰嗦的描述并道歉。
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.fileSystemObject")
Set objNet = CreateObject("WScript.Network")
Const ForReading = 1
Const ForWriting = 2
ServerName = "\\Mynetworkdrivename\Files"
ETool = objNet.computerName
updateServer = "\\" & ServerName & "\TOMART\Update\"
txtMachineList = "\\" & ServerName & "\TOMART\Machines.txt"
txtLogFile = "\\" & ServerName & "\TOMART\Logs\" & ETool & ".txt"
localTOMARTUpdate = "C:\TOMART\update\"
Set objMachineList = objFSO.OpenTextFile(txtMachineList, ForReading)
Do While objMachineList.AtEndOfStream = False
strLine = objMachineList.ReadLine
If ETool = strLine THEN
Set updServerList = objFSO.GetFolder(updateServer)
Set colSubFlds = updServerList.SubFolders
For Each fl in colSubFlds
subFldr = fl.name
If Not objFSO.folderExists _
(localTOMARTUpdate & subFldr) THEN
objFSO.copyFolder updateServer & subFldr, localTOMARTUpdate
End If
Next
Set textFile = objFSO.createTextFile(txtLogFile)
End If
Loop