
/************************************
Author                : fyy6330
Time                  : 4,29, 2010
Version               : 
Description           : 文本，邮件等合并输出
************************************/
import com;
 var ForReading = 1 
 fs = com.CreateObject("Scripting.FileSystemObject")
 OutputFile = fs.CreateTextFile("output.txt") 
 dir=io.fullpath("/合并文件")
 strComputer = "." 
 objWMIService = com.GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" + strComputer + "\root\cimv2")
 FileList = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='"++dir++"'}" ++"Where ResultClass = CIM_DataFile") 
          
 for index, objFile in com.each(FileList) {
   TextFile = fs.OpenTextFile(objFile.Name(), ForReading) 
   strText = TextFile.ReadAll()
   TextFile.Close()
   OutputFile.WriteLine(strText)
  }
 OutputFile.Close()
