China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-24 09:25
中国DOS联盟论坛 » DOS媒体世界 & 网络技术 (多媒体室) » Help, how to use batch processing to judge the host status on the router? View 2,903 Replies 1
Original Poster Posted 2010-10-27 01:18 ·  中国 福建 泉州 电信
新手上路
Credits 4
Posts 1
Joined 2010-05-12 10:35
16-year member
UID 166666
Gender Male
Status Offline
Under the routing state, the router IP is 192.168.1.1. The bound IP hosts are A, B, C, D, corresponding to 192.168.1.2, 192.168.1.3, 192.168.1.4, 192.168.1.5 respectively. How to make the batch processing automatically judge the online status of the hosts and display them in a list. For example: Host A is online, Host B is offline, Host C is online, Host D is offline. Thank you.
Floor 2 Posted 2011-01-02 18:37 ·  中国 黑龙江 哈尔滨 联通
版主
★★
系统收藏家
Credits 326
Posts 285
Joined 2010-02-22 00:00
16-year member
UID 160972
Gender Male
From 黑龙江省
Status Offline
For example, ping host a. If errorlevel = 2, it means it's not online.

@echo off
color 2e
::Check if the configuration file exists. If not, jump to the configuration interface
::if not exist setting.cmd goto set
::Start checking
:1
title Checking if the host is online...
call setting.cmd
pause
:set
title IP setting
echo Since you are using the software for the first time, now start setting the IP.
set /p a=IP of host A
echo ping %a%^>nul>setting.cmd
echo if "%errorlevel%"=="1" echo Host A is offline ELSE ECHO Host A is online>setting.cmd
set /p b=IP of host B
echo ping %b%^>nul>setting.cmd
echo if "%errorlevel%"=="1" echo Host B is offline ELSE ECHO Host B is online>setting.cmd
set /p c=IP of host C
echo ping %c%^>nul>setting.cmd
echo if "%errorlevel%"=="1" echo Host C is offline ELSE ECHO Host C is online>setting.cmd
set /p d=IP of host D
echo ping %d%^>nul>setting.cmd
echo if "%errorlevel%"=="1" echo Host D is offline ELSE ECHO Host D is online>setting.cmd
ECHO ECHO OK, detection is completed.>setting.cmd
echo Press any key to re-detect. To close, directly click the "X" in the upper right corner of the window to exit.>setting.cmd
echo pause^>nul>setting.cmd
echo goto 1>setting.cmd
ECHO Configuration completed! Press any key to start detection.
PAUSE
GOTO 1

This code has not been tested!
Let me know if there are any problems
Forum Jump: