• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.
  • The forums have been upgraded with support for dark mode. By default it will follow the setting on your system/browser. You may override it by scrolling to the end of the page and clicking the gears icon.

I have latency batch file need some help with please

TerryE

New Member
Joined
Mar 7, 2025
Messages
2 (0.03/day)
@Echo off
SETLOCAL EnableDelayedExpansion
FOR /F "skip=1" %%A IN ('WMIC OS GET LOCALDATETIME') DO (SET "t=%%A" & GOTO break_1)
:break_1
SET OUT=0F
color %OUT%
mode 44,20
echo mode 44,20
echo off & cls
Title = Ping Monitor
set IP=1.1.1.1
:top
set mydate=%date%
PING -n 1 %IP% | FIND "TTL=" >nul >> PingLog.txt
IF ERRORLEVEL 1 (SET OUT=4F & echo %mydate%:%time:~0,2%:%time:~3,2%:%time:~6,2%% : Down & Title Down %IP%) ELSE (SET OUT=2F & echo %mydate% : %time:~0,2%:%time:~3,2%:%time:~6,2%% : Up & Title Up %IP%)
color %OUT%
ping -n 3 -w 500 127.0.0.1 >nul
GoTo top

I can't figure out how to do some changes. I would like to change the time format to a 12-hour clock instead of 24-hour clock.
I would also like to have it make a sound, like a wave file, when it turns red, because it's lost connection or long ping time intervals.
I have three different files that work fine but I can't get it to work all in one file.

I've tried so many different things To no avail. Any help would be deeply appreciated.

Thanks ahead of time.
 
Sounds doable.

I recommend you try some of the AI by visiting e.g. Chatbot Arena (formerly LMSYS) (the Direct Chat tab), especially with this relatively easy script (at least it looks like it), you'd be surprised how helpful AI can be, it also explains you what it changed and what each change does (it's like using a search engine, but you find the (perfect) solution instantly) (the traffic on those question/answer sites went massively down because people use AI to find a solution now (well, not "now", but more like for 1-2 years already)).

Generally speaking, maybe try using PowerShell too (it's not new and is here to stay, no need to "POSIX" or oldschool-ing things, making them harder by not using PowerShell, but maybe I'm just too out of .bat), where things should be easier than in .bat. (Is this for a very old Win server where one'd still use .bat instead of .ps1?, but even for Win 2012 I don't remember using .bat.)
 
Thank you very much for your reply. You really opened my eyes on artificial intelligence. It's amazing what it can do. I don't know rather to be happy or afraid, but for now I'm just amazed.
Thanks again
 
Back
Top