Scripts: netstat sprachunabhaengig (0.0.0.0:0 statt LISTENING)
Made-with: Cursor
This commit is contained in:
@@ -19,8 +19,8 @@ if %errorlevel% neq 0 (
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Pruefen ob Server bereits laeuft
|
||||
netstat -an | findstr ":%PORT%.*LISTENING" > nul 2>&1
|
||||
REM Pruefen ob Server bereits laeuft (0.0.0.0:0 = Listening, sprachunabhaengig)
|
||||
netstat -an | findstr ":%PORT% " | findstr "0.0.0.0:0" > nul 2>&1
|
||||
if %errorlevel% equ 0 (
|
||||
echo WebDAV-Server laeuft bereits.
|
||||
exit /b 0
|
||||
|
||||
@@ -7,7 +7,8 @@ REM Optional: Port als Argument (z.B. stop-webdav.cmd 8080)
|
||||
if "%1"=="" (set PORT=3005) else (set PORT=%1)
|
||||
|
||||
REM Prozess auf Port finden und beenden
|
||||
for /f "tokens=5" %%a in ('netstat -ano 2^>nul ^| findstr ":%PORT% " ^| findstr "LISTENING"') do (
|
||||
REM Filter: Port + "0.0.0.0:0" = Listening (sprachunabhaengig)
|
||||
for /f "tokens=5" %%a in ('netstat -ano 2^>nul ^| findstr ":%PORT% " ^| findstr "0.0.0.0:0"') do (
|
||||
taskkill /PID %%a /F > nul 2>&1
|
||||
echo WebDAV-Server beendet (PID %%a).
|
||||
exit /b 0
|
||||
|
||||
Reference in New Issue
Block a user