我试图读取 XML 文件失败(每台计算机中的文件名都发生了变化)。如何使用通配符读取文件?
例如:D:\Logs\*.xml
脚本:
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("D:\Logs\*.xml", ForReading)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, "server1 ", "server889 ")
Set objFile = objFSO.OpenTextFile("D:\Logs\*.xml", ForWriting)
objFile.WriteLine strNewText
objFile.Closeenter code here
Run Code Online (Sandbox Code Playgroud)