Hi again,
Hopefully one of my last questions I really start enjoying to solve problems these day's and I learned a lot so far I found this simple script that replaces bad characters.
The only problem I got is I'd like to apply it to filenames something like:
How come it doesn't execute the replace function when I want to apply the function to filenames? Where do I go wrong?
Hopefully one of my last questions I really start enjoying to solve problems these day's and I learned a lot so far I found this simple script that replaces bad characters.
Code:
WScript.Echo RenFile("bad%file&name.txt")
Function RenFile(FileName)
With New RegExp
.Pattern = "[/\\:*?""<>|#{}%&~]"
.Global = True
RenFile = .Replace(FileName, "_")
End With
End Function
Code:
...
For Each objFile In colFileList
RenFile(objFile.FileName)
Next
...