If Abfrage mit oder Verknüpfung

Post Reply
StadtWN
Posts: 602
Joined: 26. Oct 2007, 12:41
Location: Waiblingen
Contact:

If Abfrage mit oder Verknüpfung

Post by StadtWN » 05. May 2009, 13:04

Hallo,

nach der Installation eines Paketes wird auf Errorlevel geprüft, das funktioniert auch. Genauso wenn ich auf den Inhalt der Log Datei prüfe. Wenn ich ich die beiden If abfragen mit ODER vernüpfe funktioniert es nicht mehr.

Meine IF Abfrage:
IF DoesTextInFileExist ("KLRIWRP: Reboot needed!", "%temp%\$klriwrp.txt") == "0" | %ErrorLevel% <> "0" Then "SET:InstallationError" EndIf

Wo liegt der Fehler? Danke für Hinweise.
Gruß
Ralf Reich

--------------------------------
Empirum V24.0.3, Windows Server 2022, SQL 15.0 Standard

novecento
Posts: 26
Joined: 07. Feb 2006, 12:29
Contact:

Post by novecento » 05. May 2009, 21:23

Hallo auch,

Ich bin mir nicht sicher ob da vielleicht eine Klammer helfen würde:
IF (DoesTextInFileExist ("KLRIWRP: Reboot needed!", "%temp%\$klriwrp.txt") == "0" | %ErrorLevel% <> "0") Then "SET:InstallationError" EndIf

Falls nicht, würde ich einfach zwei Abfragen daraus machen:

IF DoesTextInFileExist ("KLRIWRP: Reboot needed!", "%temp%\$klriwrp.txt") == "0" Then "SET:InstallationError" EndIf
IF %ErrorLevel% <> "0" Then "SET:InstallationError" EndIf

Gruß
Amir

User avatar
mniemann
Administrator
Administrator
Posts: 574
Joined: 25. Nov 2005, 17:03
Location: Mainz
Contact:

Post by mniemann » 05. May 2009, 23:55

Die Syntax der IF-Abfrage scheint in Ordnung, Herr Reich.
Ich empfehle das Konstrukt nochmal mit einfachen Vorgaben zu testen:

[Set:Product]
Set Var01=1
Set Var02=0

IF %Var01% == "1" | %Var02% == "1" THEN "Set:Bedingung_erfuellt" ENDIF

[Set:Bedingung_erfuellt]
Echo Bedingung erfüllt. Mindestens eine der Abfragen wurde positiv geprüft.

Danach kann man beide Werte tauschen und prüfen, ob das Ergebnis immer noch WAHR ist (nun für die 2. Abfrage), usw.
Visit my Blog: "DiEW - Das inoffizielle Empirum Weblog" (http://www.diew.eu)

Martin Niemann
Manager Support (Service Management)

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

StadtWN
Posts: 602
Joined: 26. Oct 2007, 12:41
Location: Waiblingen
Contact:

Post by StadtWN » 14. May 2009, 10:48

Konnte die Abfrage umgehen. Das Zeichen ist dass, das bei dem >< Zeichen auf der Tastatur ist, oder? Kann es Probleme bei der Interpretation geben?
Gruß
Ralf Reich

--------------------------------
Empirum V24.0.3, Windows Server 2022, SQL 15.0 Standard

Post Reply

Return to “Paketierung”

Who is online

Users browsing this forum: No registered users and 0 guests