源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

VBS教程:方法-Copy 方法

  • 时间:2020-06-04 08:21 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:VBS教程:方法-Copy 方法

Copy 方法

将指定的文件或文件夹从某位置复制到另一位置。 [code][i]object.[/i][b]Copy[/b][i] destination[, overwrite] [/i][/code] [h3]参数[/h3]object 必选项。应为 [b]File[/b] 或 [b]Folder[/b] 对象的名称。 destination 必选项。复制文件或文件夹的目标位置。不允许使用通配符。 overwrite 可选项。Boolean 值。如果覆盖现有文件或文件夹,则 Boolean 值为 [b]True[/b](默认);否则为 [b]False[/b]。 [h3]说明[/h3]对 File 或 Folder 应用 Copy 方法的结果与使用 FileSystemObject.CopyFile 或 FileSystemObject.CopyFolder 执行的操作完全相同。在 FileSystemObject.CopyFile 或 FileSystemObject.CopyFolder 中,使用 object 引用文件或文件夹,并将文件或文件夹作为参数传递给 FileSystemObject.CopyFile 或 FileSystemObject.CopyFolder。然而,应该注意的是 FileSystemObject.CopyFile 或 FileSystemObject.CopyFolder 方法可以复制多个文件或文件夹。 下列示例显示了 [b]Copy[/b] 方法的使用:
[code]Dim fso, MyFileSet fso = CreateObject("Scripting.FileSystemObject")Set MyFile = fso.CreateTextFile("c:\testfile.txt", True)MyFile.WriteLine("[/code]这是一个测试[code]")[/code][code]MyFile.Close[/code][code]Set MyFile = fso.GetFile("c:\testfile.txt")[/code][code][b]MyFile.Copy ([/b]"c:\windows\desktop\test2.txt"[b])[/b][/code]
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部