【问题标题】:VBScript Copy and BITS. When does it end?VBScript 复制和 BITS。什么时候结束?
【发布时间】:2015-02-06 20:16:24
【问题描述】:

所以我有一个 VBScript 来复制一个文件夹。我注意到,因为我正在进行计时赛,脚本结束后副本似乎在后台继续。

我认为正在发生的事情是,当最后一个要复制的文件开始时,脚本存在......而不是当最后一个文件完成复制时。

我认为这是由 Windows 中的 BITS 服务引起的。如果我想要准确的计时赛,我需要禁用或写入什么来确保计时赛是从头到尾的?

这就是我所拥有的

Sub CopyDirs( fromFolder, toFolder )
 Dim oFSO
 Dim c_folder, c_File, subFolder
 Set oFSO = CreateObject( "Scripting.FileSystemObject" )
 Set c_folder = oFSO.GetFolder( fromFolder )
 If Not( oFSO.FolderExists( toFolder ) ) Then
  oFSO.CreateFolder toFolder
 End If
 For Each c_File In c_folder.Files
  If Not( oFSO.FileExists( toFolder & "\" & c_File.Name ) ) Then
   oFSO.CopyFile c_folder.Path & "\" & c_File.Name, toFolder & "\" & c_File.Name
  End If
 Next
 For Each subFolder In c_folder.SubFolders
  If Not( oFSO.FolderExists( toFolder & "\" & subFolder.Name ) ) Then
   oFSO.CreateFolder toFolder & "\" & subFolder.Name
  End If
  CopyDirs subFolder.Path, toFolder & "\" & subFolder.Name
 Next
End Sub

【问题讨论】:

    标签: vbscript copy microsoft-bits


    【解决方案1】:

    文件写入被缓存。

    右键单击驱动器-属性-硬件选项卡-选择您的驱动器并单击属性按钮,然后单击策略选项卡并清除复选框。

    BITS 在后台从 Internet 下载文件,例如 Windows 更新。

    【讨论】:

    • 拍得好。那甚至不在我的雷达上。我不认为我可以控制服务器端的缓存......也许我应该最后写最小的文件?
    猜你喜欢
    • 2015-04-24
    • 2011-08-17
    • 2019-07-15
    • 2014-04-29
    • 2014-10-18
    • 2010-12-08
    • 2019-07-08
    • 2019-10-17
    • 2010-09-11
    相关资源
    最近更新 更多