如何使用 vbscript 写入 xml 文件???我想将各种文件的大小和类型打印成一个xml文件并列出来。我该怎么做?
例如:文件夹 E 有 3 个文件。所以想编写一个程序,该程序检查文件夹 E,并将其中所有文件的大小和类型列出到一个 xml 文件
请帮忙
下面是我编写的将文件夹的所有文件复制到文本文件的程序。但我想复制到 xml
Option Explicit
Dim objFSO,objf,objfolder, objFile, strFileProperties, strFiles,OBJFLD,objfile2
dim objf1,objfile1,objtextfile,strfolderproperties,objsubfld
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objf= objFSO.Getfolder("C:\Test")
set OBJFLD=objf.subfolders
for each objfolder in OBJFLD
strFolderproperties = strFolderproperties & "Number of files: " & objFolder.Files.Count & VbCrLf
set objfile2=objfolder.files
for each objfile in objfile2
' Display generel file properties
strFileProperties = strFileProperties & "File name: " & objFile.Name & VbCrLf
strFileProperties = strFileProperties & "File path: " & objFile.Path & VbCrLf
strFileProperties = strFileProperties & "File size: " & objFile.Size & " bytes" & VbCrLf
strFileProperties = strFileProperties & "File type: " & objFile.Type & VbCrLf & vbcrlf
next
next
set objf1=objfso.getfolder("E:\logs3")
set objfile1=objfso.getfile( "E:\logs3\database.txt")
set objf1=nothing
set objfile1=nothing
set objtextfile=objfso.opentextfile("E:\logs3\database.txt",8,true)
objtextfile.writeline(strfileproperties)
objtextfile.close
set objf1=objfso.getfolder("E:\logs3")
set objfile1=objfso.getfile( "E:\logs3\database.txt")
set objf1=nothing
set objfile1=nothing
set objsubfld=objfso.opentextfile("E:\logs3\database.txt",8,true)
objsubfld.writeline(strfolderproperties)
objsubfld.close