批量修改大量文本文件(或其他文件)里的内容(图片标注XML文件里的内容修改)

将png格式改为jpg格式,VBS方案:

Set WshShell = CreateObject("Wscript.Shell")
WshShell.Run "cmd /c dir /s/b *.xml> list.xml",vbHide
Wscript.Sleep 1000

sFile = "list.xml"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = objFSO.OpenTextFile(sFile,1)
Do While Not oFile.AtEndOfStream
strLine = oFile.ReadLine
If Len(strLine) > 0 Then
Set File = objFSO.OpenTextFile(strLine, 1)
aryLines = File.ReadAll
File.Close
aryLines = Replace(aryLines, "png", "jpg")
Set File = objFSO.OpenTextFile(strLine, 2)
File.Write aryLines
File.Close
End If
Loop
oFile.Close

objFSO.DeleteFile sFile
Set objFSO = Nothing

保存为VBS文件,放到TXT文件目录,双击执行。

你可能感兴趣的:(计算机视觉)