cyprian

Textausgabe in Datei aus Batch Script

Hallo,

möchte eine DFÜ Verbindung abfragen und den Inhalt in eine LOG Datei schreiben lassen.

CODE:

@echo
rasdial "DFÜ Name"
ping localhost -n 3 >NUL
echo >> statusreport_%date%.txt "ISDN Einwahl bei ... klappt! %time%"
goto end
if errorlevel 1 goto nichtda
echo >> statusreport_%date%.txt "ISDN Einwahl bei ... klappt nicht! %time%"
:end
rasdial "DFÜ Name" /Disconnect

Wenn die Verbindung nicht zu Stande kommt, schreibt er mir trotzdem, dass die Einwahl korrekt war, was ist falsch???

cyprian
Auf Facebook teilen
Auf X (Twitter) teilen
Auf Reddit teilen
Auf Linkedin teilen

Content-ID: 23669

Url: https://administrator.de/forum/textausgabe-in-datei-aus-batch-script-23669.html

Ausgedruckt am: 27.07.2025 um 09:07 Uhr

Janni
Janni 16.01.2006 um 12:25:50 Uhr
so kann das auch nicht gehen, da Du das "Erfolgsecho" immer ausführst und das andere wird nicht ausgeführt, da es zu "nichtda" geht, was nicht existiert.
Probiere mal:

if errorlevel 1 (
echo >> statusreport_%date%.txt "ISDN Einwahl bei ... klappt nicht! %time%"
) else (
echo >> statusreport_%date%.txt "ISDN Einwahl bei ... klappt! %time%")

MFG