通过本文主要向大家介绍了vbs copyfile,vbs教程,vbs教程视频,wincc vbs教程,vbs教程下载等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
Copy 方法
将指定的文件或文件夹从某位置复制到另一位置。
object.Copy destination[, overwrite]
参数
object
必选项。应为 File 或 Folder 对象的名称。
destination
必选项。复制文件或文件夹的目标位置。不允许使用通配符。
overwrite
可选项。Boolean 值。如果覆盖现有文件或文件夹,则 Boolean 值为 True(默认);否则为 False。
说明
对 File 或 Folder 应用 Copy 方法的结果与使用 FileSystemObject.CopyFile 或 FileSystemObject.CopyFolder 执行的操作完全相同。在 FileSystemObject.CopyFile 或 FileSystemObject.CopyFolder 中,使用 object 引用文件或文件夹,并将文件或文件夹作为参数传递给 FileSystemObject.CopyFile 或 FileSystemObject.CopyFolder。然而,应该注意的是 FileSystemObject.CopyFile 或 FileSystemObject.CopyFolder 方法可以复制多个文件或文件夹。
下列示例显示了 Copy 方法的使用:
</div>Dim fso, MyFileSet fso = CreateObject("Scripting.FileSystemObject")Set MyFile = fso.CreateTextFile("c:\testfile.txt", True)MyFile.WriteLine("这是一个测试")MyFile.CloseSet MyFile = fso.GetFile("c:\testfile.txt")MyFile.Copy ("c:\windows\desktop\test2.txt")

