我有两个文本文件,我需要使用VBscript将这两个文件与日期戳合并
我有两个我有两个文本文件,我需要使用VBscript将这两个文件与日期戳合并,vbscript,Vbscript,我有两个.txt文件;我已经编写了一个VBscript来识别最后修改的两个文件。代码分别回显两个修改过的文件。我需要合并这两个修改过的文件,并提供一个带有日期戳的不同名称 例如: txt1.txt txt2.txt 合并后: txt09022011.txt 假设您只想按顺序将每个文本文件的内容转储到新文本文件中: Dim strInputPath1, strInputPath2, strOutputPath Dim txsInput1, txsInput2, txsOutput Dim FS
.txt
文件;我已经编写了一个VBscript来识别最后修改的两个文件。代码分别回显两个修改过的文件。我需要合并这两个修改过的文件,并提供一个带有日期戳的不同名称
例如:
txt1.txt
txt2.txt
合并后:
txt09022011.txt
假设您只想按顺序将每个文本文件的内容转储到新文本文件中:
Dim strInputPath1, strInputPath2, strOutputPath
Dim txsInput1, txsInput2, txsOutput
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
strInputPath1 = "C:\txt1.txt"
strInputPath2 = "C:\txt2.txt"
strOutputPath = "C:\txt" & Format(Now, "ddmmyyyy") & ".txt"
' For the timestamp I use Now (today's date). Can also choose some other date.
Set txsInput1 = FSO.OpenTextFile(strInputPath1, 1)
Set txsInput2 = FSO.OpenTextFile(strInputPath2, 1)
Set txsOutput = FSO.CreateTextFile(strOutputPath)
txsOutput.Write txsInput1.ReadAll
txsOutput.Write txsInput2.ReadAll
txsInput1.Close
txsInput2.Close
txsOutput.Close
假设您只想按顺序将每个文本文件的内容转储到新文本文件中:
Dim strInputPath1, strInputPath2, strOutputPath
Dim txsInput1, txsInput2, txsOutput
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
strInputPath1 = "C:\txt1.txt"
strInputPath2 = "C:\txt2.txt"
strOutputPath = "C:\txt" & Format(Now, "ddmmyyyy") & ".txt"
' For the timestamp I use Now (today's date). Can also choose some other date.
Set txsInput1 = FSO.OpenTextFile(strInputPath1, 1)
Set txsInput2 = FSO.OpenTextFile(strInputPath2, 1)
Set txsOutput = FSO.CreateTextFile(strOutputPath)
txsOutput.Write txsInput1.ReadAll
txsOutput.Write txsInput2.ReadAll
txsInput1.Close
txsInput2.Close
txsOutput.Close