offenen Port abfragen via Batch
Hat jemand eine Idee wie ich prüfen kann, ob ein Port an nem Rechner offen ist oder nicht und dann die Ausgabe verarbeite.
Bsp:
if port open then ...
else ...
Bsp:
if port open then ...
else ...
Please also mark the comments that contributed to the solution of the article
Content-Key: 80644
Url: https://administrator.de/contentid/80644
Printed on: April 26, 2024 at 19:04 o'clock
1 Comment
Hallo, ja gibt es.
Folgendes in eine Batch schreiben.
set /a Port=50000
:S1
set /a Port=%Port%+1
REM Sucht nach einem freien Port
netstat -a | find "%port%">NUL
set Fehler=%Errorlevel%
if %Fehler% neq echo Der %Port% Port ist frei
if %Fehler% EQU 0 goto S1
Sucht ab Port 50000 nach einem freien Port.
Gruss der Nohouse303
Folgendes in eine Batch schreiben.
set /a Port=50000
:S1
set /a Port=%Port%+1
REM Sucht nach einem freien Port
netstat -a | find "%port%">NUL
set Fehler=%Errorlevel%
if %Fehler% neq echo Der %Port% Port ist frei
if %Fehler% EQU 0 goto S1
Sucht ab Port 50000 nach einem freien Port.
Gruss der Nohouse303