VBS Tutorial: Method-copy Method _vbs

Source: Internet
Author: User

Copy method

Copies the specified file or folder from one location to another.

object.Copy destination[, overwrite]

Parameters

Object

Required option. Should be the name of the File or Folder object.

Destination

Required option. The destination where the file or folder is copied. Wildcard characters are not allowed.

Overwrite

Options available. A Boolean value. If the existing file or folder is overwritten, the Boolean value is True(default), or False.

Description

The result of applying the Copy method to File or Folder is exactly the same as the action performed using Filesystemobject.copyfile or Filesystemobject.copyfolder. In Filesystemobject.copyfile or Filesystemobject.copyfolder, use object to refer to a file or folder and pass the file or folder as a parameter to the Filesystemobject.copyfile or Filesystemobject.copyfolder. However, it should be noted that the Filesystemobject.copyfile or Filesystemobject.copyfolder methods can replicate multiple files or folders.

The following example shows the use of the Copy method:

  Dim FSO, Myfileset fso = CreateObject ("Scripting.FileSystemObject") Set MyFile = fso. CreateTextFile ("C:\testfile.txt", True) MyFile.WriteLine (" This is a test ")   myfile.close   Set MyFile = fso. GetFile ("C:\testfile.txt")     Myfile.copy ( "C:\windows\desktop\test2.txt" Span class= "CFE" > )     

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.