Tracert in the BAT (allyesno)

Source: Internet
Author: User

Usage:

The program supervisor checks 5 hops to use the current directory's ip.txt file as the IP database.
You can also specify the number of hops and IP database file names.
Tip
Tip hops IP database (TIP 30 iplog.txt)

Rem build and test by allyesno in Win2k & WINXP
@ Echo off
CLS
Echo build and test by allyesno in Win2k ^ & WINXP
Echo.
The Echo program checks 5 hops to use the current directory's ip.txt file as the IP database.
Echo you can also specify the number of hops and IP database file names
Echo Use1: tip
Echo use2: tip hops IP database (TIP 30 iplog.txt)
Echo.
Set notimedout = 0
Set skip = 0
Set numberip = 1
Set notimedout = 0
Set numberline = 0
If "% 2" = "" set ipfile=ip.txt & goto YD
Set ipfile = % 2
If not exist % ipfile % echo does not find the % ipfile % file, test abort & goto endx
: YD
If not exist ip.txt ECHO does not find the ip.txt file, test abort & goto endx
If "% 1" = "" set YD = 5 & goto gogogo
Set YD = % 1
: Gogogo
For/F % A in (% ipfile %) do set/A numberline = numberline + 1
If "% numberline %" = "0" Echo IP database no available IP address & goto endx
: Freexploit
If "% notimedout %" = "1" Goto nexttest
Set numbertracert = 1
ECHO is currently detecting 1 IP Address
For/F % A in (% ipfile %) do set tempip = % A & goto allyesno
: Nexttest
If "% numberip %" = "% numberline %" Echo. & Echo no timed out IP address found in this test
Set/A numberip = numberip + 1
Echo.
ECHO is currently detecting % numberip % IP
Set numbertracert = 1
Set/a skip = skip + 1
For/F "Skip = % skip %" % A in (% ipfile %) do set tempip = % A & goto allyesno
: Allyesno
ECHO is testing % numbertracert % hops for % tempip %. Please wait.
Tracert-D-H % numbertracert % tempip % | find "timed out" & Echo.> rp.txt & Echo % date % time % timed out occurred when detecting % numbertracert % hops of % tempip %> rp.txt & tracert-D-H % numbertracert % tempip % | find "timed out"> rp.txt & goto end
If "% YD %" = "1" Goto end
If "% numbertracert %" = "% YD %" set notimedout = 1 & goto freexploit
Set/A numbertracert = numbertracert + 1
Goto allyesno
: End
Echo.
If not exist rp.txt echo no timed out IP address is found in this test. & goto endx
Type rp.txt
: Endx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.