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-07-02 09:11
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to search the whole drive for QQ and open it View 5,375 Replies 22
Original Poster Posted 2006-09-24 09:35 ·  IANA 局域网IP(Private-Use)
中级用户
★★
蝴蝶之吻
Credits 430
Posts 177
Joined 2006-09-20 12:00
19-year member
UID 63170
From 广东深圳
Status Offline
Let me give an example.

I don't know where the QQ.EXE file is. There isn't a shortcut on the desktop either,
so I want to make a batch file that can find its path on the hard drive, (for example: C:\TENCENT\QQ\QQ.EXE and save this path in another file). Save this path into another batch file, then use the CALL command to call that batch file... and then exit

Can this be done?

[[i] Last edited by namejm on 2007-2-5 at 09:39 AM [/i]]
Floor 2 Posted 2006-09-24 09:41 ·  中国 湖南 娄底 新化县 电信
银牌会员
★★★
Credits 1,218
Posts 485
Joined 2006-07-21 21:24
19-year member
UID 58987
From 湖南.娄底
Status Offline
@echo off
for %%a in (c d) do (
for /f "tokens=*" %%i in ('dir /s /a-d /b %%a:\qq.exe') do (
echo start "" "%%i">>open.bat
)
)
call open.bat

Not sure whether this matches the OP's requirement.

[ Last edited by pengfei on 2006-9-24 at 09:43 ]
Floor 3 Posted 2006-09-24 09:48 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
@echo off
for /f "skip=1 delims=" %%i in ('wmic datafile where "filename='qq' and Extension='exe'" get name') do echo start "" "%%i" >启动qq.bat
pause

This can probably meet your requirement, though it isn't the optimal solution.
Floor 4 Posted 2006-09-24 09:58 ·  IANA 局域网IP(Private-Use)
中级用户
★★
蝴蝶之吻
Credits 430
Posts 177
Joined 2006-09-20 12:00
19-year member
UID 63170
From 广东深圳
Status Offline
That does work... but there are two problems

The generated file looks like this:
start "" "c:\Tencent\QQ\QQ.exe"
But what I want is only c:\Tencent\QQ\QQ.exe

And also, after QQ is opened, can the generated file be deleted...
Floor 5 Posted 2006-09-24 10:00 ·  中国 湖南 娄底 新化县 电信
银牌会员
★★★
Credits 1,218
Posts 485
Joined 2006-07-21 21:24
19-year member
UID 58987
From 湖南.娄底
Status Offline
@echo off
for %%a in (c d) do (
for /f "tokens=*" %%i in ('dir /s /a-d /b %%a:\qq.exe') do (
start "" "%%i"
)
)


I don't know which drive the OP installed QQ on, so by default it searches drives C and D. If you want to improve efficiency, just enter the drive letter where QQ is installed.
Floor 6 Posted 2006-09-25 01:06 ·  IANA 局域网IP(Private-Use)
中级用户
★★
蝴蝶之吻
Credits 430
Posts 177
Joined 2006-09-20 12:00
19-year member
UID 63170
From 广东深圳
Status Offline
It's my fault. I described it wrong.

It should be like this.
I just don't know where that file is. For example, where is the LANDTIMER.INI file? I want to find it and get a few lines of text information from inside the file.
The file contents are written like this

[option]
TYPE=0
IP=192.168.151.153
PROXY=*.COM
……
and so on
I just want to write them separately into different files. The filenames just need to match the letters before the equals sign...
Floor 7 Posted 2006-09-25 01:13 ·  中国 甘肃 张掖 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Once you've already found the file path, then just do for /f %%i in (‘file path’) do (echo ............) and it'll be fine~
Floor 8 Posted 2006-09-25 02:39 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
  Try the code below and see whether it works (administrator privileges required, efficiency isn't very high):

@echo off
setlocal enabledelayedexpansion
for /f "delims=\" %%i in ('fsutil fsinfo drives^|find /v ""') do (
set var=%%i
set drive=!var:~-2!
fsutil fsinfo drivetype !drive!|find "固定">nul && (
for /f "tokens=*" %%j in ('dir /a-d /b /s !drive!\LANDTIMER.INI 2^>nul') do (
set filename=%%~nj
for /f "tokens=1 delims==" %%k in ("%%j") do (
if /i "!filename!"=="%%k" echo "%%j">>test.bat
)
)
)
)


[ Last edited by namejm on 2006-9-25 at 02:41 ]
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 9 Posted 2006-09-25 03:16 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
The moderator's skillful wmic statements are really admirable``
I admit defeat``
Floor 10 Posted 2006-09-25 03:16 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
@echo off
setlocal ENABLEDELAYEDEXPANSION
for /f "skip=1 tokens=*" %%i in ('wmic datafile where "filename='LANDTIMER' and Extension='ini'" get caption') do set str="%%i" !str!
for /f "skip=1 usebackq delims== tokens=1,2*" %%i in (%str%) do echo %%j>>%%i.txt

Only tested in the case where there is only one landtimer.ini on the whole drive; by default it processes them all.
Floor 11 Posted 2006-09-25 03:23 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Just check the registry, there will definitely be a QQ path there

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 12 Posted 2006-09-25 03:33 ·  新加坡 腾讯云
初级用户
Credits 73
Posts 30
Joined 2006-09-18 08:35
19-year member
UID 62944
Status Offline
Floor 13 Posted 2006-09-25 05:46 ·  IANA 局域网IP(Private-Use)
中级用户
★★
蝴蝶之吻
Credits 430
Posts 177
Joined 2006-09-20 12:00
19-year member
UID 63170
From 广东深圳
Status Offline
Thanks. Your answers were wonderful....
The problem has already been solved,,,
Floor 14 Posted 2007-04-20 23:55 ·  中国 山东 淄博 联通
中级用户
★★
Credits 272
Posts 99
Joined 2006-06-02 09:12
20-year member
UID 56414
Status Offline
HKLM\SOFTWARE\Tencent\QQ\Install
is the QQ installation path, if it exists
Floor 15 Posted 2007-04-21 03:01 ·  中国 新疆 乌鲁木齐 电信
高级用户
★★★
Autowalk
Credits 845
Posts 375
Joined 2007-03-03 01:58
19-year member
UID 80606
Gender Male
Status Offline

::The following code can search for and open QQ!
@echo off
for %%i in (c,d,e,f) do for /f "delims=" %%n in ('dir /s /b %%i:\qq.exe') do start "" "%%n"
pause
Forum Jump: