vendredi 2 octobre 2015

vbsript continues loop to rename file

Trying to create a vbscript that loops continuously until it finds the specific file and renames it to a different extension with minute and seconds.

do Set fso = CreateObject("Scripting.FileSystemObject") Set myFile = fso.GetFile("C:\Users\user\Downloads\test.txt")

If (fso.FileExists(myFile)) Then myFile.Move "C:\Users\user\Downloads\test.xml" End If

WScript.Sleep 1000

loop

The above works and renames the file but when looped it errors with "file cannot be found" Will need to add a else statement but having a hard time doing that.

Aucun commentaire:

Enregistrer un commentaire