自动获取QQ路径的几种方法:读注册表、全盘搜索、获取进程信息等:- @echo off
- REM 使用ftype获取QQ路径
- for /f "tokens=1* delims==" %%a in ('ftype Tencent') do (
- set FilePath=%%~dpbQQ.exe
- )
- echo %FilePath%
- pause
复制代码
- @echo off
- REM 使用WMIC获取进程信息中的QQ路径(要求QQ处于运行状态)
- for /f "tokens=2 delims==" %%a in ('wmic process where "name='qq.exe'" get executablepath /value') do (
- set FilePath=%%a
- )
- echo %FilePath%
- pause
复制代码
- @echo off
- REM 使用WMIC全盘搜索获取QQ路径
- for /f "skip=1 delims=" %%a in ('wmic datafile where "filename='qq' and extension='exe'" get name') do (
- set FilePath=%%a
- )
- echo %FilePath%
- pause
复制代码
- @echo off
- REM 使用reg query命令读注册表获取QQ路径
- for /f "tokens=2*" %%a in ('reg query HKEY_LOCAL_MACHINE\Software\Tencent\QQ /v Install^|findstr "Install"') do (
- set FilePath=%%b
- )
- echo %FilePath%
- pause
复制代码
- @echo off
- REM 使用reg export命令到处注册表项再搜索获取QQ路径以避免reg query可能存在的吃中文字符的问题
- reg export "HKEY_LOCAL_MACHINE\SOFTWARE\Tencent\QQ" "%temp%\qq.txt">nul
- for /f "tokens=2 delims==" %%a in ('type "%temp%\qq.txt"^|findstr /i "Install"') do (
- REM 可以用 %%~fa 直接把字符串中的\\变成\
- set FilePath=%%~a
- )
- set FilePath=%FilePath:\\=\%
- echo %FilePath%
- pause
复制代码
- @echo off
- REM 调用VBS读注册表获取QQ路径
- >"%temp%\my.vbs" echo Set WshShell = WScript.CreateObject("WScript.Shell")
- >>"%temp%\my.vbs" echo WScript.Echo WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Tencent\QQ\Install")
- for /f "delims=" %%a in ('cscript /nologo "%temp%\my.vbs"') do (
- set FilePath=%%a
- )
- echo %FilePath%
- pause
复制代码
- @echo off
- REM 全盘搜索获取QQ路径
- set fName=qq.exe
- for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
- if exist %%a:\nul (
- pushd %%a:\
- for /r %%b in (%fName%?) do (
- if /i "%%~nxb" equ "%fName%" (
- set FilePath=%%b
- goto :show
- )
- )
- popd
- )
- )
- :show
- echo %FilePath%
- pause
复制代码 从2009开始QQ不再支持命令行方式登录,请尝试发送按键的方式。
VBS发送按键自动登录QQ
http://bbs.bathome.net/thread-7893-1-1.html
AutoIt版QQ登录器
http://bbs.bathome.net/thread-2789-1-1.html
===================================================================================
原理及使用方法:- start "" "C:\Program Files\Tencent\QQ\qq.exe" /start QQUIN:843875648 PWDHASH:4Z1c1a8DeNoF9j+JHHRnrw== /stat:40
复制代码
经测试,目前无法用这个方法登陆最新的QQ2009正式版,可能是新版的QQ未开启这个命令行接口吧,只能继续期待以后的版本了。 |