Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Renames a disk file, directory, or folder.
Syntax
NameoldpathnameAsnewpathname
The Name statement syntax has these parts:
Part | Description |
oldpathname | Required. String expression that specifies the existing file name and location may include directory or folder, and drive. |
newpathname | Required. String expression that specifies the new file name and location may include directory or folder, and drive. The file name specified by newpathname can't already exist. |
Remarks
The Name statement renames a file and moves it to a different directory or folder, if necessary. Name can move a file across drives, but it can only rename an existing directory or folder when both newpathname and oldpathname are located on the same drive. Name cannot create a new file, directory, or folder.
Using Name on an open file produces an error. You must close an open file before renaming it. Nameargument cannot include multiple-character (*) and single-character (?) wildcards.
Please sign in to use this experience.
Sign in