中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-03 19:25
48,038 topics / 350,123 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » [Closed] How to use batch processing to obtain the IP address of the PPP dial-up connection
Printable Version  2,165 / 10
Floor1 Macadd Posted 2006-10-01 10:12
高级用户 Posts 168 Credits 638
How to use batch processing to obtain the IP address of a PPP dial-up connection?

[ Last edited by HAT on 2008-10-15 at 20:44 ]
Floor2 namejm Posted 2006-10-01 11:22
荣誉版主 Posts 1,737 Credits 5,226 From 成都
I don't know what purpose you have for the IP address obtained from the PPP dial-up connection. I searched for relevant discussions with "IP" as the keyword and posted a few search results. The poster can go and have a look:

1、How to set IP address and DNS with BAT file?;
2、How to get the local IP and MAC address in batch processing and then bind them?;
3、Reprint: How to change the IP address at the command line
4、Ask how to write BAT to obtain computer name, workgroup name and IP address
……
Floor3 redtek Posted 2006-10-01 11:33
金牌会员 Posts 1,147 Credits 2,902
Type IPCONFIG at the DOS prompt and press Enter, and you can see IP addresses and other information similar to the following.

IPCONFIG is the command to view current IP address information

Floor4 3742668 Posted 2006-10-01 11:36
荣誉版主 Posts 718 Credits 2,013
1. WMIC

You should be able to see the PPP dial-up IP by entering this in the command line.
2. netsh

Generally speaking, netsh will display the PPP dial-up IP first when showing the IP, so "show ip 1" should achieve the purpose. Similarly, "show ip 2" will display the IP of the network card. (If anyone's IP arrangement is opposite to mine, please let me know. I don't have conditions to test here.)
3. ipconfig

Opposite to netsh, ipconfig will display the network card IP first when showing the IP, so just get the subsequent IP to get the IP we need.
Floor5 electronixtar Posted 2006-10-01 11:40
铂金会员 Posts 2,672 Credits 7,493
%appdata%\Microsoft\Network\Connections\Pbk\rasphone.pbk
%systemroot%\System32\Ras
There are very files in these two folders, which can be analyzed with for
Floor6 Macadd Posted 2006-10-02 10:50
高级用户 Posts 168 Credits 638
Thanks, Moderator 3742668.

But

wmic nicconfig where Description="WAN (PPP/SLIP) Interface" get ipaddress
'wmic' is not recognized as an internal or external command, operable program or batch file.

netsh diag show ip 1
The following command was not found: diag show ip 1.

When selecting the dial-up connection at login, ipconfig displays the IP of the PPP dial-up connection first.

Please give advice!

I have read the posts introduced by Moderator namejm, but they are not very helpful.
Floor7 pengfei Posted 2006-10-02 10:55
银牌会员 Posts 485 Credits 1,218 From 湖南.娄底
The building owner posts the display of ipconfig for everyone to see.
Floor8 3742668 Posted 2006-10-02 11:09
荣誉版主 Posts 718 Credits 2,013
Could it be that you installed the Home edition of XP? The Home edition of XP doesn't have the WMI component, so there's no WMIC either. Maybe the unsuccessful execution of the netsh command is related to it.
My test environment is Professional Edition SP2. Please state your system environment.
Floor9 Macadd Posted 2006-10-03 09:06
高级用户 Posts 168 Credits 638
Thanks, I'll use other methods.
Floor10 jastyg Posted 2006-10-07 03:18
中级用户 Posts 82 Credits 219
My environment: 3 network cards, 2 PPPOE connections, that is, 5 connections. The part of the script I made for a friend to do ADSL dual-line (simultaneously surfing with Netcom and Telecom):

@echo off
ipconfig/all >>iptable.txt
for /f "skip=48 tokens=2 delims=:" %%i in (iptable.txt) do echo %%i >>2.txt
set /p ip=<2.txt
echo %ip%
pause
del *.txt >nul

If you want to use it, you need to modify it according to your actual situation. You only need to change the value of skip=48 to the line number where the IP is in iptable.txt.

[ Last edited by jastyg on 2006-10-7 at 03:21 ]
Floor11 amtf15 Posted 2008-10-15 20:35
初级用户 Posts 17 Credits 26
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023