小编OmZ*_*OmZ的帖子

如何在VBscript中使用通配符查找和读取文件?

我试图读取 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)

io vbscript file

2
推荐指数
1
解决办法
6077
查看次数

标签 统计

file ×1

io ×1

vbscript ×1