WIN7下如何判断VPN是否已连上,如何获取VPN的域名?
现在换成了WIN7系统尝尝鲜,但是很多BAT代码无法执行了
这是XP下的判断VPN是否已连上代码- for /f "skip=1 delims=" %%a in ('rasdial') do (
- ipconfig|findstr/i "%%a">nul&&(
- echo VPN已连上!
- pause
- exit
- )
- goto :next
- )
- :next
- echo VPN没连上!
- pause
- exit
复制代码 ----------------------
这是XP下获取VPN的域名代码- @echo off
- SetLocal EnableDelayedExpansion
- set "filename=C:\Documents and Settings\All Users\Application Data\Microsoft\Network\Connections\Pbk\rasphone.pbk"
- for /f "tokens=1 delims=:" %%a in ('type "%filename%" ^| findstr /I /N "type=2"') do set /a num=%%a+77
- for /f "tokens=2 delims==" %%a in ('more +%num%^<"%filename%" ^| findstr "\<PhoneNumber\>"') do set xz=%%a
- echo %xz%
- pause
- exit
复制代码 ----------------------------
WIN7下BAT和XP的区别有点大啊,谁有相关的教程和文档让我学习下呢、、
谢谢! |