Tin tức và phân tích của tất cả các thiết bị di động

Cách thiết lập cảnh báo kết nối internet trên hệ thống của bạn Windows 10

Nếu internet của bạn đang hoạt động và bạn cần theo dõi xem mình có được kết nối hay không, cách dễ nhất để thực hiện việc này là xem biểu tượng WiFi trong khay hệ thống trên hệ thống của bạn Windows 10. Khi bạn mất kết nối Internet, dấu chấm than màu vàng sẽ xuất hiện trên biểu tượng WiFi. Bạn cũng có thể ping trang web. Nếu bạn không thể quan sát khay hệ thống và tiếng ping có vẻ gây phiền toái, bạn có thể thiết lập cảnh báo âm thanh khi kết nối internet trên hệ thống của mình Windows 10 với một kịch bản đơn giản.

CẢNH BÁO SPOILER: Cuộn xuống và xem video hướng dẫn ở cuối bài viết này.

Cảnh báo kết nối Internet

Tập lệnh này ban đầu được viết bởi Superuser Fabby và được cải tiến bởi VMMF. Tập lệnh yêu cầu bạn tải xuống một công cụ miễn phí có tên là Công cụ GNU cho Win32. Giải nén nó và tìm trong thư mục sau để tìm tệp EXE có tên Sleep.exe.

UnxUtilsusrlocalwbin

Điều này là để thêm thời gian chờ đợi giữa các lần kiểm tra. Tệp EXE này phải nằm trong cùng thư mục nơi bạn lưu tập lệnh. Bạn không cần bất cứ điều gì khác, vì vậy bạn có thể loại bỏ nó.

Mở Notepad và dán đoạn sau vào đó. Lưu nó với phần mở rộng CMD và chạy tệp. Tệp sound.vbs sẽ được tạo bởi tập lệnh, vì vậy đừng lo lắng về điều đó.

@ECHO OFF

:whileNoInternet

set "host=8.8.8.8"

::check if internet is working

PING -n 1 -w 5000 "%host%" | findstr /r /c:"[0-9] *ms"

if %errorlevel% neq 0 (

::the internet is not working keep cheking until it does
 echo No internet yet %TIME%
 GOTO whileNoInternet
)

echo we gained internet
::the internet is working play internet ON song

@echo off
set "file=InternetON_GOGOGO.mp3"
( echo Set Sound = CreateObject("WMPlayer.OCX.7"^)
 echo Sound.URL = "%file%"
 echo Sound.Controls.play
 echo do while Sound.currentmedia.duration = 0
 echo wscript.sleep 100
 echo loop
 echo wscript.sleep (int(Sound.currentmedia.duration^)+1^)*1000) >sound.vbs
start /min sound.vbs
@ECHO OFF
:whileInternet

sleep.exe 5s

::check if internet is still working

PING -n 1 -w 1000 "%host%" | findstr /r /c:"[0-9] *ms"

if %errorlevel% == 0 (

::the internet is still working keep cheking until it does not
 echo We have internet %TIME%
 GOTO whileInternet
)

:: detect possible internet glitches (do not trust the first failure)
echo internet glitch detected
sleep.exe 10s

PING -n 1 -w 1000 "%host%" | findstr /r /c:"[0-9] *ms"

if %errorlevel% == 0 (

::the internet is still working keep cheking until it does not
 echo We have internet %TIME%
 GOTO whileInternet
)

:: if it failed twice in a row most likely internet is down

echo we lost internet
::the internet is not working anymore, play internet OFF song

@echo off
set "file=InternetHasFallen.mp3"
( echo Set Sound = CreateObject("WMPlayer.OCX.7"^)
 echo Sound.URL = "%file%"
 echo Sound.Controls.play
 echo do while Sound.currentmedia.duration = 0
 echo wscript.sleep 100
 echo loop
 echo wscript.sleep (int(Sound.currentmedia.duration^)+1^)*1000) >sound.vbs
start /min sound.vbs

::start monitoring if it comes back
GOTO whileNoInternet

Đó là tất cả những gì bạn phải làm. Cửa sổ Dấu nhắc Lệnh sẽ vẫn mở và sẽ kiểm tra trạng thái kết nối Internet của bạn. Nếu nó thay đổi, bạn sẽ nghe thấy âm thanh tắt máy.