If-Abfrage für Internetverbindung

Moderator: MVogt

Post Reply
Julia
Posts: 384
Joined: 31. Aug 2007, 13:56
Location: Essen
Contact:

If-Abfrage für Internetverbindung

Post by Julia » 15. Feb 2010, 10:12

Hallo,

Ich würde gerne in einer setup.inf die Internetverbindung prüfen.
Mit dem Ziel, dass nur wenn eine Verbindung ins Internet besteht, bestimmte Befehle ausgeführt werden.

Mir ist nur leider nicht klar, ob und wie man das umsetzen kann. Man könnte zwar mit einer Batch-Datei einen Ping (z.B. auf Google) starten, aber wie bekomme ich dann das Ergebnis in die setup.inf?

Hat jemand eine Idee dazu?

Gruß Julia

Marcus_B
Posts: 126
Joined: 15. Jul 2008, 13:02
Location: Berlin
Contact:

Post by Marcus_B » 15. Feb 2010, 10:16

Hallo Julia,

Eventuell das Ergebnis des Pings in eine Datei schreiben und die dann abrüfen mit If DoesTextInFileExist.

Gruß Marcus

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

Post by Hendrik_Ambrosius » 15. Feb 2010, 10:38

Optional kann man auch alive.exe mit CALL aufrufen und den ErrorLevel auswerten.
Download hier: http://dl.dropbox.com/u/2271599/misc/Alive.exe
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.

Julia
Posts: 384
Joined: 31. Aug 2007, 13:56
Location: Essen
Contact:

Post by Julia » 15. Feb 2010, 15:14

Hallo,
erstmal Danke für die schnellen Antworten :)

Der Tipp mit der Alive.exe funktioniert gut. Ich habe nur gerade festgestellt, dass es mein Problem leider nicht ganz löst.
Wenn der Proxy-Server an dem Rechner nicht eingerichtet ist, funktioniert der Ping trotzdem. Also bringt mir das doch nichts.

Ich bastel da erstmal noch etwas weiter, wenn ich es nicht hinbekomme, melde ich mich nochmal.

Gruß Julia

imbas
Posts: 60
Joined: 07. May 2008, 08:23
Location: Stuttgart
Contact:

Post by imbas » 16. Feb 2010, 11:53

Hai,

eventuell kann man die Prüfung mit lynx (http://www.vordweb.co.uk/standards/download_lynx.htm), einem Browser auf commandline, testen.

Julia
Posts: 384
Joined: 31. Aug 2007, 13:56
Location: Essen
Contact:

Post by Julia » 16. Feb 2010, 14:26

Hi,

leider funktioniert das auch nicht, da lynx über eine spezielle Config-Datei seine Proxyinfos bekommt. Und wenn ich die direkt mitgeben würde, heißt es ja noch nicht, dass dies im IE auch eingestellt ist.

Ich habe aber noch eine neue Idee.
In der Registry unter HKCU gibt es einen Key "ProxyEnable", wenn der Wert "1" ist, ist der Proxy aktiv.
Wie man mit Empirum prüft, ob ein Key vorhanden ist, weiß ich. Aber kann man auch auf einen bestimmten Wert prüfen?

imbas
Posts: 60
Joined: 07. May 2008, 08:23
Location: Stuttgart
Contact:

Post by imbas » 16. Feb 2010, 14:57

Set %MyVar=%HKCU,"Software\......%
If "%MyVar%" == "Keine Ahnung" Then "DoThis" Else "DoThat" EndIf

philipp.kiessler
Posts: 248
Joined: 05. Feb 2007, 11:42
Contact:

Post by philipp.kiessler » 16. Feb 2010, 17:41

Es geht sogar mit

Code: Select all

If "%HKLM,schlach-mich-dod%" == "?" Then "Set:DoThis" Else "Set:DoThat" EndIf
aber mit Zwischenschritt vermeidet man unter Umständen Probleme.

Wäre es nicht auch sinnvoll neben "Proxy Enable" auch die Konfiguration selbst auszulesen? Es könnte ja ein Proxy aktiviert sein, der aber der Falsche ist...
Philipp Kießler

Julia
Posts: 384
Joined: 31. Aug 2007, 13:56
Location: Essen
Contact:

Post by Julia » 17. Feb 2010, 08:54

Danke erstmal... werds die Tage nochmal testen :)

@Philipp: Ja, das hatte ich mir auch schon überlegt. Aber da das ja genauso funktionieren würde, habe ich dafür nicht extra gefragt. Trotzdem danke, für den Hinweis.

User avatar
Theo_Gottwald
Posts: 367
Joined: 03. Oct 2009, 08:57
Location: Herrenstr.11 * 76706 Dettenheim
Contact:

Post by Theo_Gottwald » 17. Feb 2010, 09:49

Da gibt es doch auch was vom Package Robot.

Der Package Robot hat dafür extra Befehle, die mehr machen als nur "PING". Man kann damit direkt einen Servername bzw. IP-Adresse und einen Port angeben.

Zum Beispiel:
IPA\ - if port available
oder
ISA\ - if Server available

Damit kann man sich leicht eine EXE machen die flexibel zur Anforderung passt.
Die sind ganz einfach anzuwenden.

Post Reply

Return to “Package Robot”

Who is online

Users browsing this forum: No registered users and 4 guests