Windows资源管理器查找和替换

时间:2016-10-12 18:13:56

标签: vbscript

在SuperUser上找到了一个很好的vbScript代码,它可以像在Office中查找和替换一样,找到并更改文件夹中的字符/单词,以便根据自己的喜好进行批量编辑。我想知道是否可以扩展此代码以调用根目标文件夹下的任何和所有子文件夹?

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

https://superuser.com/questions/197380/how-do-i-find-and-replace-a-character-in-filenames-in-windows-7-using-explorer

0 个答案:

没有答案