How do I rename a file using VBScript?

后端 未结 7 1933
北恋
北恋 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:26

    Yes you can do that.
    Here I am renaming a .exe file to .txt file

    rename a file

    Dim objFso  
    Set objFso= CreateObject("Scripting.FileSystemObject")  
    objFso.MoveFile "D:\testvbs\autorun.exe", "D:\testvbs\autorun.txt"
    

提交回复
热议问题