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:

Use it from the Windows Explorer address bar

Copy the .vbs file to %LocalAppData%\Microsoft\WindowsApps

Now, from any folder in Windows Explorer, type rename.vbs and you can rename any file in that folder.

Use rename (without .vbs) from the Windows Explorer address bar

Alongside the rename.vbs, add the following .bat file in %LocalAppData%\Microsoft\WindowsApps:
if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start "" /min "%~dpnx0" %* && exit
wscript %LocalAppData%\Microsoft\WindowsApps\rename.vbs
exit
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
This page was cached on 04 Apr 2025 - 11:46.