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-06-25 06:48
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Extract file version information (version number) View 3,401 Replies 18
Original Poster Posted 2007-06-07 16:08 ·  中国 北京 联通
初级用户
Credits 28
Posts 9
Joined 2007-04-26 01:00
19-year member
UID 86482
Gender Female
Status Offline
Please ask the user to clarify the specific requirements or provide more detailed context for an accurate translation. The current text seems to be in Chinese and the request is to translate it, but more clarity is needed. If we assume a basic translation of the main question: "May I ask: How to extract the file names and version numbers in the windows folder using the command line and save them to a txt file? Most of the files are in .exe, .dll format. Thanks. It doesn't have to be batch processing, other languages are also okay, can you give an example? Thanks. [ Last edited by mandyonly on 2007-6-7 at 04:27 PM ]" But this might not be fully accurate without a better understanding of the exact context. However, following the instructions strictly, this is the attempted translation. But perhaps there's a need for more precision. Let's try again:

"May I ask: How to extract the file names and version numbers in the Windows folder using the command line and save them to a text file? Most files are in .exe, .dll format. Thanks. It doesn't have to be batch processing; other languages are also acceptable. Can you provide an example? Thanks. [ Last edited by mandyonly on 2007-6-7 at 04:27 PM ]"
Floor 2 Posted 2007-06-07 16:19 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
It seems that it's unlikely to extract the version number with batch processing. I tried using VBS before, but I've forgotten it now.
Floor 3 Posted 2007-06-07 16:41 ·  中国 广东 深圳 电信
新手上路
Credits 19
Posts 10
Joined 2007-05-31 11:23
19-year member
UID 89848
Gender Male
Status Offline
WMIC datafile where "Name='c:\\windows\\explorer.exe'" get Manufacturer,Version,Filename
Floor 4 Posted 2007-06-07 16:47 ·  中国 北京 联通
初级用户
Credits 28
Posts 9
Joined 2007-04-26 01:00
19-year member
UID 86482
Gender Female
Status Offline
What language is this written in?
Floor 5 Posted 2007-06-07 17:05 ·  中国 浙江 杭州 联通
银牌会员
★★★
Credits 1,928
Posts 931
Joined 2007-01-06 11:46
19-year member
UID 75624
Gender Male
Status Offline
wmic datafile where "Name='c:\\windows\\explorer.exe'" get Manufacturer,Version,Filename
Is it P?
Floor 6 Posted 2007-06-07 17:12 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Floor 7 Posted 2007-06-07 17:13 ·  中国 北京 联通
初级用户
Credits 28
Posts 9
Joined 2007-04-26 01:00
19-year member
UID 86482
Gender Female
Status Offline
If the file is multiple and exists in a folder, and I want to extract all the file names and versions in the folder instead of a specific one as mentioned in the 5th floor, how to do it?
Floor 8 Posted 2007-06-07 17:33 ·  中国 上海 联通
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
```
@echo off
set Target=C:\\test
cd %Target%
for %%i in (*.*) do (
rem echo %%i
wmic datafile where "Name='%Target%\\%%i'" get Manufacturer,Version,Filename
)
```
Floor 9 Posted 2007-06-07 18:02 ·  中国 北京 联通
初级用户
Credits 28
Posts 9
Joined 2007-04-26 01:00
19-year member
UID 86482
Gender Female
Status Offline
Thanks
Floor 10 Posted 2007-06-08 02:12 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
```wmic /output:result.log datafile where "Path='\\windows\\system32\\' and Drive='C:' and (Extension='dll' or Extension='exe')" get Manufacturer,Version,Caption```

Running time may be a little longer, please be patient.
Floor 11 Posted 2007-06-09 22:19 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
VBS, only extract "application" (exe) and "application extension" (dll) with version numbers
Path = "C:\windows"

Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(Path)

For Each strFileName in objFolder.Items
name = objFolder.GetDetailsOf(strFileName, 0)
Extension = objFolder.GetDetailsOf(strFileName, 2)
ver = objFolder.GetDetailsOf(strFileName, 37)
If not ver = "" Then
If Extension = "应用程序" Then
str = str & name & ".exe:" & ver & vbCrLf
Else
If Extension = "应用程序扩展" Then str = str & name & ":" & ver & vbCrLf
End If
End If
Next

Set fW = fso.OpenTextFile("result.log", 2, True)
fW.WriteLine str
fW.close


Extract all "application" (exe) and "application extension" (dll)
Path = "C:\windows"

Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(Path)

For Each strFileName in objFolder.Items
name = objFolder.GetDetailsOf(strFileName, 0)
Extension = objFolder.GetDetailsOf(strFileName, 2)
ver = objFolder.GetDetailsOf(strFileName, 37)
If Extension = "应用程序" Then
str = str & name & ".exe:" & ver & vbCrLf
Else
If Extension = "应用程序扩展" Then str = str & name & ":" & ver & vbCrLf
End If
Next

Set fW = fso.OpenTextFile("result.log", 2, True)
fW.WriteLine str
fW.close


[ Last edited by zh159 on 2007-6-9 at 10:21 PM ]
Floor 12 Posted 2007-06-10 08:07 ·  中国 北京 联通
初级用户
Credits 88
Posts 41
Joined 2006-03-08 17:38
20-year member
UID 51603
Status Offline
Oh, good East Asia.
Floor 13 Posted 2007-07-06 10:42 ·  中国 湖北 襄阳 电信
初级用户
Credits 25
Posts 13
Joined 2007-06-15 11:32
19-year member
UID 91401
Gender Male
Status Offline
Is it that complicated? The command "filever /v filename" can be used to get the version information of a file.
Floor 14 Posted 2007-07-06 10:46 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
Is filever a third-party tool?
Floor 15 Posted 2007-07-06 11:57 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Originally posted by wbshu at 2007-7-6 10:42:
Is it that troublesome?
You can use the "filever /v filename" command to get the version information of a file.

C:\>filever/?
'filever' is not an internal or external command, nor is it a runnable program
or batch file.
Forum Jump: