[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[网络连接] 批处理如何获取VPN的域名(IP)?

网络连接里有2个连接:
1个是本地连接,
另1个是虚拟专用网络连接,也就是VPN
请问,如何获取到VPN的域名:118.108.168.26

本机没有vpn,所以请楼主将你的ipconfig /all的结果贴出来
***共同提高***

TOP

没连VPN之前:


Windows IP Configuration



        Host Name . . . . . . . . . . . . : ACE

        Primary Dns Suffix  . . . . . . . :

        Node Type . . . . . . . . . . . . : Mixed

        IP Routing Enabled. . . . . . . . : No

        WINS Proxy Enabled. . . . . . . . : No



Ethernet adapter 本地连接:



        Connection-specific DNS Suffix  . :

        Description . . . . . . . . . . . : Realtek PCIe GBE Family Controller

        Physical Address. . . . . . . . . : 00-30-67-17-33-A8

        Dhcp Enabled. . . . . . . . . . . : No

        IP Address. . . . . . . . . . . . : 192.168.199.199

        Subnet Mask . . . . . . . . . . . : 255.255.255.0

        Default Gateway . . . . . . . . . : 192.168.1.1

        DNS Servers . . . . . . . . . . . : 202.101.224.68

                                            202.101.224.69

----------------------------------------------------------------------------------------------------------------
连上了VPN之后:



Windows IP Configuration



        Host Name . . . . . . . . . . . . : ACE

        Primary Dns Suffix  . . . . . . . :

        Node Type . . . . . . . . . . . . : Mixed

        IP Routing Enabled. . . . . . . . : No

        WINS Proxy Enabled. . . . . . . . : No



Ethernet adapter 本地连接:



        Connection-specific DNS Suffix  . :

        Description . . . . . . . . . . . : Realtek PCIe GBE Family Controller

        Physical Address. . . . . . . . . : 00-30-67-17-33-A8

        Dhcp Enabled. . . . . . . . . . . : No

        IP Address. . . . . . . . . . . . : 192.168.199.199

        Subnet Mask . . . . . . . . . . . : 255.255.255.0

        Default Gateway . . . . . . . . . : 192.168.1.1

        DNS Servers . . . . . . . . . . . : 202.101.224.68

                                            202.101.224.69



PPP adapter 虚拟专用网络连接:



        Connection-specific DNS Suffix  . :

        Description . . . . . . . . . . . : WAN (PPP/SLIP) Interface

        Physical Address. . . . . . . . . : 00-57-58-00-00-00

        Dhcp Enabled. . . . . . . . . . . : No

        IP Address. . . . . . . . . . . . : 169.254.18.24

        Subnet Mask . . . . . . . . . . . : 255.255.255.255

        Default Gateway . . . . . . . . . : 169.254.18.24

        DNS Servers . . . . . . . . . . . : 213.141.138.33

                                            213.141.138.34

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ipconfig/all里看不出VPN的域名

TOP

回复 3楼 的帖子

这样行不?
  1. @echo off
  2. rem rasphone.pbk不是ANSI格式
  3. set "filename=%allusersprofile%\application data\microsoft\network\connections\pbk\rasphone.pbk"
  4. for /f "tokens=1 delims=:" %%a in ('type "%filename%" ^| findstr /I /N "type=2"') do set /a num=%%a+77
  5. for /f "tokens=2 delims==" %%a in ('more +%num%^<"%filename%" ^| findstr "\<PhoneNumber\>"') do set ip=%%a
  6. echo.IP Address: %ip%
  7. pause
复制代码

TOP

原帖由 lxzzr 于 2011-3-12 17:49 发表
这样行不?
@echo off
rem rasphone.pbk不是ANSI格式

set "filename=%allusersprofile%\application data\microsoft\network\connections\pbk\rasphone.pbk"

for /f "tokens=1 delims=:" %%a in ('type "%fi ...


L版的代码很强大啊!!!
你的代码是获取现在正在连接使用的IP域名
如果我的网络连接里有N个VPN,但我还要获取名字为“虚拟专用网络连接”这个名字的IP域名呢?
不管他是连接还是未连接状态,这个貌似有点难度

TOP

返回列表