简体   繁体   中英

Renaming files on my PC all at once without external program

I want to rename several files at once. For example, change _ to - . I don't want to install and external program and want to know if there is an inbuilt feature. I am running Windows 10.

A VBS Script File should work.

Set objFso = CreateObject("Scripting.FileSystemObject")
Set Folder = objFSO.GetFolder("File Location")

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

Next

Save it as .vbs and run it.

NOTE: This isn't the place to ask questions like this. SuperUser.com would be ideal for these kind of questions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM