请问:如何将windows文件夹中的文件名称和版本号用命令行提取出来,并存到一个txt文件中?文件大都是.exe,.dll格式。多谢。
不一定一定要用批处理,用其他语言也可以,能不能给出例子呢?谢谢.
[ Last edited by mandyonly on 2007-6-7 at 04:27 PM ]
不一定一定要用批处理,用其他语言也可以,能不能给出例子呢?谢谢.
[ Last edited by mandyonly on 2007-6-7 at 04:27 PM ]
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
@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
)
wmic /output:result.log datafile where "Path='\\windows\\system32\\' and Drive='C:' and (Extension='dll' or Extension='exe')" get Manufacturer,Version,CaptionPath = "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.closePath = "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.closeOriginally posted by wbshu at 2007-7-6 10:42:
要这么麻烦吗?
用"filever /v filename" 命令就可以得到一个文件的版本信息.
C:\>filever/?
'filever' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
Originally posted by qinbuer at 2007-7-7 03:39 PM:
filever集成在Windows XP Service Pack 2 Support Tools中,可在华军或者微软官方下载:
http://www.onlinedown.net/soft/21532.htm
http://www.microsoft.com/downloads/de ... 谢谢了!!