• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

I have latency batch file need some help with please

TerryE

New Member
Joined
Mar 7, 2025
Messages
1 (0.33/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.
 
Joined
Jun 26, 2023
Messages
81 (0.13/day)
Processor 7800X3D @ Curve Optimizer: All Core: -25
Motherboard TUF Gaming B650-Plus
Memory 2xKSM48E40BD8KM-32HM ECC RAM (ECC enabled in BIOS)
Video Card(s) 4070 @ 110W
Display(s) SAMSUNG S95B 55" QD-OLED TV
Power Supply RM850x
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.)
 
Top