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-09 10:07
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] What method can be used to get a program's version information View 816 Replies 4
Original Poster Posted 2008-08-06 09:50 ·  中国 山东 淄博 联通
银牌会员
★★★
Credits 1,604
Posts 646
Joined 2008-04-13 23:39
18-year member
UID 115804
Gender Male
Status Offline
As the title says, I want to get it with a batch file; using a third-party tool is also fine.
心绪平和,眼藏静谧,无比安稳的火... Purification of soul...Just a false...^_^
Floor 2 Posted 2008-08-06 09:51 ·  中国 广东 广州 天河区 电信
高级用户
★★
我思故我在
Credits 512
Posts 228
Joined 2007-01-21 10:31
19-year member
UID 77225
Gender Male
Status Offline
WMIC, search first.
我确实是只菜鸟,而且这里X人太多,所以我不敢装X。谁要再说我装X,我就XXOO他。
Floor 3 Posted 2008-08-06 09:52 ·  中国 山东 淄博 联通
银牌会员
★★★
Credits 1,604
Posts 646
Joined 2008-04-13 23:39
18-year member
UID 115804
Gender Male
Status Offline
sorry, I forgot to search first~
Found the answer.
Moderator, please delete this thread. Sorry about that.
心绪平和,眼藏静谧,无比安稳的火... Purification of soul...Just a false...^_^
Floor 4 Posted 2008-08-06 10:05 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Floor 5 Posted 2008-08-06 10:24 ·  中国 江苏 苏州 吴江区 电信
银牌会员
★★★
Credits 1,608
Posts 780
Joined 2007-10-07 10:19
18-year member
UID 99089
Gender Male
Status Offline

@echo off
::Use wmic to get version information for a non-system program (using Thunder as an example)
for /f "skip=1 delims=" %%i in ('wmic datafile where "Name='C:\\Program Files\\Thunder

Network\\Thunder\\Thunder.exe'" get Version') do (echo version obtained with wmic:%%i)
::Use the registry to get version information for a non-system program (using Thunder as an example)
for /f "skip=4 tokens=3" %%i in ('reg query "HKLM\Software\Thunder Network\ThunderOem\thunder_backwnd" /v

Version') do (echo version obtained from registry:%%i)

::Result
::version obtained with wmic:5, 6, 8, 19
::version obtained from registry:5.8.3.556
::Personally I think the version obtained from the registry is more accurate; maybe the two represent the data differently
pause

Even if I list all the wmic information, I still can't find the same information as in the registry.

wmic datafile where name="c:\\program files\\thunder network\\thunder\\thunder.exe" list full /format:hform >d.html&d.html


[ Last edited by huahua0919 on 2008-8-6 at 10:33 AM ]
Forum Jump: