windows 获取 dll 或 exe 的文件版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6697878/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 17:26:11  来源:igfitidea点击:

Get the file version of a dll or exe

windowsbatch-file

提问by Calumet

Possible Duplicates:
Command line tool to dump Windows DLL version?
How do I retrieve the version of a file from a batch file on Windows Vista?

可能的重复项:
用于转储 Windows DLL 版本的命令行工具?
如何从 Windows Vista 上的批处理文件中检索文件的版本?

Is it possible to get the file version of a dll or exe file using batch commands and store it in a variable?

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

回答by Dave

Here's an example using sigcheck:

下面是一个使用 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

回答by serk

Have a look at the Sysinternals utility SigCheck. Try this in your batch script:

查看 Sysinternals 实用程序SigCheck。在您的批处理脚本中试试这个:

sigcheck.exe -n YourFile.exe