批处理获取本机正在运行的QQ的号码
原文地址:http://www.cn-dos.net/forum/view ... mp;page=2#pid308613- @echo off
- setlocal enabledelayedexpansion
- rem 请根据QQ实际路径进行修改或者自行添加自动获取QQ路径的功能模块
- rem 自动获取QQ路径的几种方法:读注册表、全盘搜索、获取进程信息等
- set QQPath=C:\Program Files\Tencent\QQ\
- tasklist /nh /fi "imagename eq QQ.exe" 2>nul|findstr /i "QQ.exe">nul||goto :NoQQ
- for /f %%a in ('dir /b /ad /o-d "%QQPath%"^|findstr "^[1-9][0-9]*$"') do (
- for /f "delims=" %%h in ('dir /s /b "%QQPath%%%a\qqstatcount.dat"') do (
- set LastModify=%%~th
- rem 如果某个在线的QQ长期不活动,可能无法获得其号码。
- if "!LastModify:~0,13!"=="!date:~0,10! !time:~0,2!" (
- echo 本机正在运行的QQ号:%%a [!LastModify!]
- )
- )
- )
- goto :end
- :NoQQ
- echo 本机没有QQ在运行
- :end
- pause
复制代码 批处理自动获取最快速的QQ服务器
原文地址:http://www.cn-dos.net/forum/viewthread.php?tid=40395- @echo off
- for /f "skip=3 tokens=1-3" %%a in ('ping -n 1 -l 1 sz.tencent.com') do echo %%c >"QQlist.txt"
- for /f "skip=3 tokens=1-3" %%a in ('ping -n 1 -l 1 sz1.tencent.com') do echo %%c >>"QQlist.txt"
- for /f "skip=3 tokens=1-3" %%a in ('ping -n 1 -l 1 sz2.tencent.com') do echo %%c >>"QQlist.txt"
- for /f "skip=3 tokens=1-3" %%a in ('ping -n 1 -l 1 sz3.tencent.com') do echo %%c >>"QQlist.txt"
- for /f "skip=3 tokens=1-3" %%a in ('ping -n 1 -l 1 sz4.tencent.com') do echo %%c >>"QQlist.txt"
- for /f "skip=3 tokens=1-3" %%a in ('ping -n 1 -l 1 sz5.tencent.com') do echo %%c >>"QQlist.txt"
- for /f "skip=3 tokens=1-3" %%a in ('ping -n 1 -l 1 sz6.tencent.com') do echo %%c >>"QQlist.txt"
- for /f "skip=3 tokens=1-3" %%a in ('ping -n 1 -l 1 sz7.tencent.com') do echo %%c >>"QQlist.txt"
-
- set MinL=99
- set MinT=9999ms
- set Best=""
- for /f "usebackq" %%a in ("QQlist.txt") do (
- call :time %%a
- )
- echo 最佳服务器:%Best%
- echo 最佳服务器的响应时间:%MinT%
- goto :eof
-
- :time
- for /f "skip=11 tokens=4 delims==" %%a in ('ping %1') do (
- if "%%a" equ " 0ms" (
- set /a Best=%1
- ) else (
- call :best %%a %1
- )
- goto :eof
- )
-
- :best
- for /f "skip=1 delims=:" %%a in ('^(echo %1^&echo.^)^|findstr /o ".*"') do set nowlen=%%a
- if "%nowlen%" lss "%MinL%" (
- set /a MinL=%nowlen%
- set MinT=%1
- set Best=%2
- ) else if "%nowlen%" equ "%MinL%" (
- if "%1" lss "%MinT%" (
- set MinT=%1
- set Best=%2
- )
- )
- goto :eof
复制代码
- @echo off&setlocal enabledelayedexpansion
- echo 请稍候......
- for /f "delims=" %%a in ('more +16 "%~0"') do (
- set tx=%%a&set var=
- for /f "tokens=1-4 delims=[]=" %%i in ('ping %%a^|findstr /i "%%a Average"') do call:LP "%%j" "%%l")
- for /f "tokens=1,2 delims=-=0" %%i in ('set -') do echo 最快服务器:%%j IP地址:!%%j! 响应时间%%i&goto end
- :end
- pause&exit
- :LP
- if not defined var set var=%~1
- if not %2=="" (
- set str=%~2&set str=!str: =!
- set str=00000000!str!&set str=!str:~-10!
- set -!str!=%TX%&set %TX%=!var!
- )
- goto :eof
- sz.tencent.com
- sz1.tencent.com
- sz2.tencent.com
- sz3.tencent.com
- sz4.tencent.com
- sz5.tencent.com
- sz6.tencent.com
- sz7.tencent.com
复制代码
|