Log inRegister
You are here: Boossy » Software » SwVbScriptFiles

VBScript Script Files

rename.vbs

And in particular a rename that involves the euro symbol (€).

If you do a rename in a .bat file, the euro symbol is fucked up.

If you type the euro symbol in a .vbs file to output it in a file name, it will also fail.

You can do it this way:
Dim sName
Dim fso
Dim fol

Set fso = WScript.CreateObject("Scripting.FileSystemObject")
Set fol = fso.GetFolder(".")

Dim val, f_val
val = 28.60
f_val = FormatCurrency(val, 2)

For Each fil In fol.Files
   ' check if the file name contains euro
   If InStr(1, fil.Name, "euro") <> 0 Then
      ' rename
      sName = Replace(fil.Name, "euro", f_val)
      ' rename the file
      fil.Name = sName
   End If
Next

Sources:
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback