Windows 获取dll或exe的文件版本

Windows 获取dll或exe的文件版本,windows,batch-file,Windows,Batch File,可能的重复项: 是否可以使用批处理命令获取dll或exe文件的文件版本并将其存储在变量中?查看Sysinternals实用程序。 在批处理脚本中尝试以下操作: sigcheck.exe -n YourFile.exe 下面是一个使用sigcheck的示例: @ECHO OFF FOR /F "tokens=1-3" %%i IN ('p:\supporttools\sigcheck.exe p:\supporttools\procmon.exe') DO ( IF "%%i %%j"==

可能的重复项:


是否可以使用批处理命令获取dll或exe文件的文件版本并将其存储在变量中?

查看Sysinternals实用程序。 在批处理脚本中尝试以下操作:

sigcheck.exe -n YourFile.exe

下面是一个使用sigcheck的示例:

@ECHO OFF

FOR /F "tokens=1-3" %%i IN ('p:\supporttools\sigcheck.exe p:\supporttools\procmon.exe') DO ( IF "%%i %%j"=="File version:" SET filever=%%k )

ECHO The version of the file is %filever%

PAUSE

谢谢SigCheck和Filever都转储文件版本。我正在尝试将批处理文件中的变量设置为文件版本。我搞不懂那部分内容。@Calumet到目前为止您尝试了什么?我搞不懂如何在批处理文件的变量中捕获版本号。最好使用sigcheck而不是filever。您可以轻松地将任何一个小实用程序捆绑到您的项目中,以确保它可用,并且都在XP和更高版本上运行,但filever具有.net依赖性。此外,sigcheck中的-n开关非常有用,我不确定filever是否有等效的。