China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-10 23:03
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Closed] How to automatically search for the path of QQ and copy a program into it to run View 2,567 Replies 15
Original Poster Posted 2008-10-01 21:19 ·  中国 湖南 长沙 电信
新手上路
Credits 10
Posts 3
Joined 2008-10-01 20:49
17-year member
UID 127192
Gender Male
Status Offline
Little brother wants to make a portable U-disk QQ login program. The main program is done, but I don't know how to automatically copy it to the QQ directory of someone else's computer to run. Please, senior moderator, give me some advice!
(Do I need to set the QQ variable?)
Thank you all for your help, but how to realize copying the program into the QQ directory? (I mean, can starting a BAT program once realize copying the file into the QQ directory and running it)

Is this the command line?
copy e:\1.txt %QQPath%

Use tireless brother's
echo off
reg export HKEY_LOCAL_MACHINE\SOFTWARE\Tencent\QQ tmp.orz
more tmp.orz>tmp2.orz
for /f "skip=3 delims== tokens=2" %%o in (tmp2.orz) do set qqpath=%%o
copy e:\1.txt %qqpath:\\=\%
del tmp*.orz
pause

It shows that the syntax of file name, directory or volume label is incorrect
[ Last edited by HAT on 2008-12-5 at 22:52 ]
Floor 2 Posted 2008-10-01 22:08 ·  中国 福建 漳州 联通
中级用户
★★
Credits 228
Posts 125
Joined 2008-08-25 19:17
17-year member
UID 124135
Gender Male
Status Offline
@echo off
for /f "skip=4 tokens=1,2 delims=:" %%a in ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\Tencent\QQ /v Install') do (
set QQPathL=%%a
set QQPathR=%%b
)
set QQPath=%QQPathL:~-1%:%QQPathR%
echo %QQPath%
pause
This code is to get the installation directory of QQ.
Floor 3 Posted 2008-10-01 22:54 ·  中国 江西 赣州 电信
银牌会员
★★★★
Credits 2,025
Posts 1,122
Joined 2007-09-05 20:15
18-year member
UID 96653
Gender Male
Status Offline
---------------------

[ Last edited by tireless on 2008-10-3 at 19:30 ]
Floor 4 Posted 2008-10-01 23:20 ·  中国 江西 赣州 电信
银牌会员
★★★★
Credits 2,025
Posts 1,122
Joined 2007-09-05 20:15
18-year member
UID 96653
Gender Male
Status Offline
Strange, executing:

for /f "skip=4 tokens=2*" %a in ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\Tencent\QQ /v Install') do @echo %b


The result obtained is D:\Program Files\深度 DEEPQ
And the correct path is D:\Program Files\深度 DEEPQQ\

Why?

[ Last edited by tireless on 2008-10-1 at 23:27 ]
Floor 5 Posted 2008-10-02 03:36 ·  中国 云南 昆明 电信
中级用户
★★
Credits 220
Posts 99
Joined 2008-06-26 15:12
18-year member
UID 120818
Gender Male
Status Offline
for /f "skip=4 tokens=2*" %a in ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\Tencent\QQ /v Install') do @echo %b



Missing SP3 patch. It will be okay after installing. I also encountered this before.
Reg seems to have incomplete support for Chinese. This was told to me by Brother HAT.

[ Last edited by 23112656 on 2008-10-2 at 03:39 ]
Floor 6 Posted 2008-10-02 11:01 ·  中国 江西 赣州 电信
银牌会员
★★★★
Credits 2,025
Posts 1,122
Joined 2007-09-05 20:15
18-year member
UID 96653
Gender Male
Status Offline
Under the command prompt, the results displayed by reg query are complete.

But when outputting the results of reg query to a file, there will be fewer characters.

[ Last edited by tireless on 2008-10-4 at 12:30 ]
Floor 7 Posted 2008-10-04 12:00 ·  中国 江西 赣州 电信
银牌会员
★★★★
Credits 2,025
Posts 1,122
Joined 2007-09-05 20:15
18-year member
UID 96653
Gender Male
Status Offline
You can only first export the registry.

@echo off
reg export HKEY_LOCAL_MACHINE\SOFTWARE\Tencent\QQ qq_.tmp
for /f "delims== tokens=2" %%o in ('more qq_.tmp^|find /i "install"') do set qqpath=%%o
COPY E:\1.TXT %qqpath:\\=\%
del qq_.tmp
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
HAT +2 2008-12-05 22:52
Floor 8 Posted 2008-10-04 12:42 ·  中国 重庆 九龙坡区 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
There is a bug in the reg.exe of the Chinese version of XP SP2. When reg query encounters Chinese characters, it may "eat characters". For details, see http://www.cn-dos.net/forum/viewthread.php?tid=22202

The solutions are as follows:
1. Replace the reg.exe of the Chinese version of XP SP2 with reg.exe from operating systems with versions higher than XP SP2 (such as XP SP3/2003/Vista, etc., the English version of XP SP2 is also acceptable)
2. Call VBS to read the registry and pass the returned result to BAT
3. Use reg export to export the registry key to a temporary file, and then search the file. It should be noted that the file exported by reg export is in Unicode encoding format, and the type command can be used for processing
Floor 9 Posted 2008-12-05 17:26 ·  中国 广东 深圳 电信
初级用户
★★
游手好闲 + 无所事事 ..
Credits 194
Posts 167
Joined 2007-04-30 09:43
19-year member
UID 87022
Gender Male
Status Offline
Why not use the following one? Maybe you have several QQs, or you are using a green version without a registry path? Then run the following batch file while QQ is running.

echo off
title This program can display the path of the program "QQ.EXE" running in memory
cls

for /f "delims==" %%a in ('wmic process where caption^="qq.exe" get CommandLine^|find "QQ.exe"') do set qqpath=%%a
set qqpath=%qqpath:~1,-11%

echo %qqpath%

pause
set qqpath
Floor 10 Posted 2008-12-05 19:30 ·  中国 上海 电信
初级用户
Credits 37
Posts 39
Joined 2007-12-07 22:44
18-year member
UID 105020
Gender Male
Status Offline
Originally posted by exzzz at 2008-12-5 05:26 PM:
Why not use the following one? Maybe you have several QQs, or you are using a portable version without a registry path?
Then run the following batch script while QQ is running.

echo off
title This program can ...

This brother is quite skillful in using batch processing variables
Floor 11 Posted 2008-12-05 20:03 ·  中国 重庆 江北区 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
What if someone didn't run QQ, heh heh.
Floor 12 Posted 2008-12-05 22:14 ·  中国 四川 泸州 联通
高级用户
★★★
Credits 609
Posts 374
Joined 2006-08-02 22:38
20-year member
UID 59720
Status Offline
@echo off
for %%f in (C D E F G H I J K L M N O P) do (
for /f %%i in ('dir %%f:\qq.exe /a /b /s') do set qq=%%i
)
start %qq%
Floor 13 Posted 2008-12-05 22:32 ·  中国 北京 联通
中级用户
★★
Credits 313
Posts 162
Joined 2007-04-02 06:45
19-year member
UID 83693
Gender Male
Status Offline
Rainbow QQ patch green version, it seems that you don't need to run QQ to find the path of QQ, which is the path of the last run of QQ. I don't know the principle.
Floor 14 Posted 2008-12-05 22:44 ·  中国 四川 泸州 联通
高级用户
★★★
Credits 609
Posts 374
Joined 2006-08-02 22:38
20-year member
UID 59720
Status Offline
Does this meet the requirements?
@echo off
for %%f in (C D E F G H I J K L M N O P) do (
for /f %%i in ('dir %%f:\qq.exe /a /b /s') do @echo %%i>qq.txt
)
for /f "delims=" %%a in ('findstr /n .* qq.txt') do (
set "var=%%a"
setlocal enabledelayedexpansion
set var=!var:*:=!
if not "!var!"=="" set var=!var:qq.exe=!
echo.!var!>qqdz.txt
endlocal
)
del qq.txt
for /f %%i in (qqdz.txt) do set qqdz=%%i
copy e:\1.txt %qqdz%
del qqdz.txt
start %qqdz%\1.txt


[ Last edited by ZJHJ on 2008-12-5 at 22:46 ]
Floor 15 Posted 2008-12-06 09:32 ·  中国 吉林 长春 电信
初级用户
★★
Credits 132
Posts 68
Joined 2008-07-29 20:51
18-year member
UID 122345
Gender Male
Status Offline
Green version of QQ can also be recognized. As long as it runs once, the path will exist in the registry.
@echo off
setlocal enabledelayedexpansion
for /f "skip=4 delims=" %%i in ('reg query HKEY_CLASSES_ROOT\CLSID\{2D616D8F-F1BA-43A1-BEF0-E2A82A0FBD56}\LocalServer32 /ve 2^>nul') do set qqPath=%%i&set qqPath=!qqPath:~14!&set tmpVar=0&call :subPathChange "!qqPath!"
echo !qqPath!&pause&exit

:subPathChange
if !tmpVar! equ 0 set tmpVar=1&set qqPath=%~fs1&call :subPathChange "!qqPath!"
set qqPath=%~dp1
goto :eof
Forum Jump: