Lesen Sie die TXT-Datei Zeile für Zeile

Ich habe Probleme, das vbscript dazu zu bringen, den Text zeilenweise zu lesen. Dies sind die Schritte, die der Code ausführen sollte:

Lesen Sie folder.txtÖffnen Sie die in folder.txt aufgeführte DateiEcho den Inhalt in test.txtLesen Sie die Datei folder-list.txtÖffnen Sie die in folder-list.txt aufgeführte DateiÖffnen Sie dirlist.txt und geben Sie Zeile für Zeile ein Echo aus

Ein Beispiel dafür, was folder.txt enthält:

C:\Documents and Settings\Administrator\Desktop\ArtistCG\[ Go! Go! Heaven!!]_____________25 -______ ___- [525067]\test.txt
C:\Documents and Settings\Administrator\Desktop\ArtistCG\[12CUT] _____ (Gakkou no Kaidan) [518382]\test.txt
C:\Documents and Settings\Administrator\Desktop\ArtistCG\[2____] _____!__CD__________ [521206]\test.txt
C:\Documents and Settings\Administrator\Desktop\ArtistCG\[Ability] _____________________ [514182]\test.txt

Ein Beispiel dafür, was folder-list.txt enthält:

C:\Documents and Settings\Administrator\Desktop\ArtistCG\[ Go! Go! Heaven!!]_____________25 -______ ___- [525067]\dirlist.txt
C:\Documents and Settings\Administrator\Desktop\ArtistCG\[12CUT] _____ (Gakkou no Kaidan) [518382]\dirlist.txt
C:\Documents and Settings\Administrator\Desktop\ArtistCG\[2____] _____!__CD__________ [521206]\dirlist.txt
C:\Documents and Settings\Administrator\Desktop\ArtistCG\[Ability] _____________________ [514182]\dirlist.txt

Ein Beispiel dafür, was jede dirlist.txt enthält

C:\Documents and Settings\Administrator\Desktop\ArtistCG\[ Go! Go! Heaven!!]_____________25 -______ ___- [525067]\00.jpg
C:\Documents and Settings\Administrator\Desktop\ArtistCG\[ Go! Go! Heaven!!]_____________25 -______ ___- [525067]\a_01.jpg
C:\Documents and Settings\Administrator\Desktop\ArtistCG\[ Go! Go! Heaven!!]_____________25 -______ ___- [525067]\a_02.jpg
C:\Documents and Settings\Administrator\Desktop\ArtistCG\[ Go! Go! Heaven!!]_____________25 -______ ___- [525067]\a_03.jpg

Und das ist der vbscript-Code

Option Explicit

Dim objFSO, strTextFile, strData, strLine, arrLines, aniTextFile, aniData, aniLines, meLine, objTextFile, fso, inputFileList, sFolderName, fname
Dim iim1, iret, iret2, iret3, i
CONST ForReading = 1

strTextFile = "C:\Documents and Settings\Administrator\Desktop\ArtistCG\folder.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
strData = objFSO.OpenTextFile(strTextFile,ForReading).ReadAll
arrLines = Split(strData,vbCrLf)

For Each strLine in arrLines
  strData = objFSO.OpenTextFile(strLine,ForReading).ReadAll
WScript.Echo strData

aniTextFile = "C:\Documents and Settings\Administrator\Desktop\ArtistCG\folder-list.txt"

Set objFSO = CreateObject("Scripting.FileSystemObject")
aniData = objFSO.OpenTextFile(aniTextFile,ForReading).ReadAll
aniLines = Split(aniData,vbCrLf)

Set fso = CreateObject("Scripting.FileSystemObject")
Set listFile = fso.OpenTextFile(aniLines).ReadAll
do while not listFile.AtEndOfStream 
    fName =  listFile.ReadLine()
    WScript.Echo fName
    Loop
Next

Bisher funktionierten nur die Schritte 1 bis 4, aber ich kann dirlist.txt nicht lesen. Irgendwelche Lösungen hier?

Antworten auf die Frage(1)

Ihre Antwort auf die Frage