Bat code for retrieving IP addresses and generating TXT text in Batch Processing

Source: Internet
Author: User

Method 1: CopyCode The Code is as follows: @ echo off
<"% ~ F0 "More + 5> TMP. vbs
Cscript // nologo/E: VBScript TMP. vbs % 1> ip.txt
Echo> NUL & del TMP. vbs
Goto: EOF
Set Odom = wscript. GetObject ("http://www.duosc.com/ip.aspx ")
Do until odom. readystate = "complete"
Wscript. Sleep 200
Loop
S=odom.doc umentelement. innertext
Set Re = new Regexp
Re. pattern = "(\ D +) \. (\ D + )"
For each m in re. Execute (s)
Wscript. Echo m
Next

Method 2: Use vbs codeCopy codeThe Code is as follows: @ echo off
ECHO is connecting. Please wait...
> Getip. vbs echo set Odom = wscript. getObject ("http://www.ip138.com/ip2city.asp"): Do until Odom. readystate = "complete": wscript. sleep 200: loop: wscript. echo odom.doc umentelement. outertext: Set Odom = nothing
For/F "tokens = 2, * delims =:" % I in ('"cscript // nologo getip. vbs "') Do ECHO: % I % j> ip.txt
Del getip. vbs

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.