Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

Batch/PowerShell function to ping IP and Port

Hey all,

With help from Beigevenus we got this little script together to tell you whether a server is online or offline through an exact port, which I'm fairly certain you can't do in Batch alone (the port thing)


Hope it helps someone here! 

Code
set ip=IP to check
set port=1234
call :serverstatus

echo Server is %status%
::will return 'server is offline/online'
pause
::do other stuff here
exit

:serverstatus
if exist %temp%\server.txt del %temp%\server.txt
powershell TNC -ComputerName %ip% -Port %port% >%temp%\server.txt

set database=%temp%\server.txt
for /F "delims=" %%a in ('findstr /I /N "true" %database%') do set "datalookup=%%a"
if "%datalookup%"=="" (set status=offline) else (set status=online)
goto :EOF
you can use telnet ip/host port
[Image: bitcoin.png] Be Nice For Once 15hVUVz7xA4kazHdk2BuErENGCskVwjYXP
Forgot to add a pause/exit in this, fixed it up now.
Nice one Sir-Teabag! 🤝


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Robert RougeSep 24, 2026 10:02 AM 4 219 Sep 24, 2026 10:02 AM
Last Post: Anonynuk
[.NET] by samir5000Mar 13, 2025 01:32 PM 3 328 Mar 13, 2025 01:32 PM
Last Post: Bastille
[Shell] by PELockDec 9, 2024 09:42 AM 3 661 Dec 9, 2024 09:42 AM
Last Post: PELock