Windows – How to find and replace a character in filenames in Windows 7 using Explorer

filenamesfind and replacerenamewindows 7

I want to replace all the underscore characters (_) with a space () in a filename.

How can I do this quickly, when I have lots of _ characters to replace?

Best Answer

vbScript should do it for you. Create a file called "rename_underscores.vbs" containing the following.

Set objFso = CreateObject("Scripting.FileSystemObject")
Set Folder = objFSO.GetFolder("c:\test\")

For Each File In Folder.Files
    sNewFile = File.Name
    sNewFile = Replace(sNewFile,"_"," ")
    if (sNewFile<>File.Name) then 
        File.Move(File.ParentFolder+"\"+sNewFile)
    end if

Next

Make sure the folder name is correct. (In the example, I've used c:\test) And then double click your file to do the renaming.

Related Question