Textdatei zeilenweise auswerten

Willkommen in unserer deutschsprachigen Anwendergemeinde.
Stellen Sie ruhig ihre Fragen oder teilen Sie ihr Wissen mit anderen.

Moderator: hdroege

Post Reply
fdooo
Posts: 103
Joined: 14. Aug 2006, 15:07
Contact:

Textdatei zeilenweise auswerten

Post by fdooo » 29. Jan 2026, 14:19

Hallo
ich stehe auf dem Schlauch.
Ich möchte mit Empirum eine Textdatei zeilenweise auslesen und jede Zeile im Paket weiter verwenden.
Beispiel:
Textdatei Source.txt:
Eins
Zwei
Drei

Im Paket:
Wenn in der Datei Muster.txt die "Zeile1" (Eins) aus Source.txt enthalten ist dann gehe zu set:go
Das Ganze soll dann so oft durchlaufen bis die Source.txt durchlaufen ist.

User avatar
Frank Dethlefsen
Posts: 558
Joined: 06. Apr 2006, 22:01
Location: Bochum
Contact:

Re: Textdatei zeilenweise auswerten

Post by Frank Dethlefsen » 30. Jan 2026, 08:57

Moin!

Geht, glaube ich, so mit Bordmitteln out of the box nicht.

Muss es denn unbedingt eine Source.txt sein?

Könnte es ggf. auch eine Source.ini sein?

[Source]
1=eins
2=zwei
3=drei
usw.

Das bekommt man hin mit der Setup.inf ...

Code: Select all

For LOOP,1,99,1,ReadIni

[ReadIni]
Set LoopLine=%%%Src%\Source.ini,Source,%LOOP%%%
ReplaceEnv LoopLine
If "%LoopLine%" != "" Then "DoWhatYouWant" EndIf

[DoWhatYouWant]
ECHO %LOOP% = %LoopLine%
Last edited by Frank Dethlefsen on 30. Jan 2026, 14:01, edited 1 time in total.
Frank Dethlefsen
Consultant und Coach
UPDATENOW GmbH
Frank.Dethlefsen@updatenow.de
https://empirum.blogspot.de/

User avatar
Hendrik_Ambrosius
Moderator
Moderator
Posts: 8098
Joined: 13. Dec 2004, 23:10
Location: Adendorf/Lüneburg

Re: Textdatei zeilenweise auswerten

Post by Hendrik_Ambrosius » 30. Jan 2026, 09:17

Idee dazu aus einem alten KB-Eintrag von mir:

The commands built into the Empirum script interpreter (setup.exe) do not allow reading a specific line from a text file.

Solution:
Convert the TXT-file to an INI-file and read the line using the built-in INI-commands:

Sourcefile TEXT.TXT:
A
B
C
D
E
F
G

Destinationfile INI.INI:

[Section]
line1=A
line2=B
line3=C
line4=D
line5=E
line6=F
line7=G

Batch that must be called from the setup.inf:

@echo off
echo [Section] >INI.INI
set counter=1

for /f %%d in (text.txt) do (
set string=%%d
call :count
)
goto END

:count
echo line%counter%=%STRING% >>INI.INI
set /a counter=counter+1

:END
Hendrik Ambrosius / Senior Presales Consultant
Mobile: +49 172 408 4447 | hendrik.ambrosius@matrix42.com
Matrix42 GmbH | Elbinger Straße 7 | 60487 Frankfurt am Main | Germany | www.matrix42.com

Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of Matrix42 or of the support team.

User avatar
Hendrik_Ambrosius
Moderator
Moderator
Posts: 8098
Joined: 13. Dec 2004, 23:10
Location: Adendorf/Lüneburg

Re: Textdatei zeilenweise auswerten

Post by Hendrik_Ambrosius » 30. Jan 2026, 09:20

Andere Idee: Wenn es nur darauf ankommt ob ein String IRGENDWO in der Textdatei ist kann man auch auf die Existenz abprüfen:

If DoesTextInFileExist ("ObjectNotFound", "%temp%\KB123456.txt") == "1" Then "Set:Installation" Else "Exit" EndIf
Hendrik Ambrosius / Senior Presales Consultant
Mobile: +49 172 408 4447 | hendrik.ambrosius@matrix42.com
Matrix42 GmbH | Elbinger Straße 7 | 60487 Frankfurt am Main | Germany | www.matrix42.com

Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of Matrix42 or of the support team.

fdooo
Posts: 103
Joined: 14. Aug 2006, 15:07
Contact:

Re: Textdatei zeilenweise auswerten

Post by fdooo » 31. Jan 2026, 09:11

Vielen Dank für die Anregungen und Hilfen.
Nein, es geht mir nicht um das vorhanden sein eines Textes in einer Datei.
Ich will wirklich zeilenweise den Inhalt auslesen und den Wert weiterverarbeiten.
Die Lösung mit der Ini Datei sieht gut aus da ich die "Textdatei" selber anlege und pflege.

Post Reply

Return to “Deutsch”

Who is online

Users browsing this forum: No registered users and 0 guests