vbs批量替换不同目录下的指定内容
SetoFso=CreateObject("Scripting.FileSystemObject")dima,dira=""dir=inputbox("请输入文件夹路径,...
Set oFso = CreateObject("Scripting.FileSystemObject")dim a,dira=""dir = inputbox("请输入文件夹路径,点击确定开始处理文件")treeIt(dir)Function TreeIt(sPath) Set oFso = CreateObject("Scripting.FileSystemObject") Set oFolder = oFso.GetFolder(sPath) Set oSubFolders = oFolder.Subfolders Set oFiles = oFolder.Files For Each oFile In oFiles a = ofile.path & vbcrlf msgbox a Set File = oFSO.OpenTextFile(a) f = File.ReadAll File.Close f = Replace(f, " ", "") f = Replace(f, "-", "") f = Replace(f, ":", "") f = Replace(f, ":", "") Set File = oFSO.OpenTextFile(a) File.Write f File.Close Next For Each oSubFolder In oSubFolders TreeIt(oSubFolder.Path) NextEnd Functionmsgbox "OK"'我想替换掉一个文件夹下所有文件的空格,横杠,冒号为空,可是我这个写法报错,求大神帮我修改
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询