How do I rename a file using WSH?

A. Using the MoveFile method on a FileSystem object will result in a file being renamed:

Dim fso<br>
Set fso = CreateObject("Scripting.FileSystemObject")<br>
fso.MoveFile "file1.txt", "file2.txt"

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish