How do I rename a file using VBScript?

后端 未结 7 1981
北恋
北恋 2020-12-11 01:44

I am trying to rename a file and was using the below code but it does not seem to work. Can someone please tell me why? What is the correct way to rename a file from VBScrip

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-11 02:30

    You can rename the file using FSO by moving it: MoveFile Method.

    Dim Fso
    Set Fso = WScript.CreateObject("Scripting.FileSystemObject")
    Fso.MoveFile "A.txt", "B.txt"
    

提交回复
热议问题