提取文件版本版本“ s&quot”使用CMD的字段
我是批处理脚本的新手,正在寻找一种使用CMD上命令提取.exe文件的“产品版本”字段的方法。
我确实使用此命令设法获得了文件的常规“版本”字段:
wmic datafile where Name="C:\\Users\\MyProgram.exe" get Version
是否有任何方法可以修改此命令行以提取“产品版本”字段?
没有WMIC的任何其他解决方案也会很好:) 谢谢。
I am new at batch scripting and looking for a way to extract the "Product Version" field of an .exe file using a command on cmd.
I did managed to get the regular "Version" field of a file using this command:
wmic datafile where Name="C:\\Users\\MyProgram.exe" get Version
is there any way to modify this command line for extracting the "Product Version" field?
Any other solution without wmic at all will also be good :)
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试使用此批处理文件来轻松获取产品版本;在此示例中,我尝试了 Google Chrome :
或者您可以尝试使用PowerShell和Batch 在powershell中获取文件版本:
You can give a try with this batch file to get easily your Product Version; in this example i tried with Google chrome :
Or You can try with Powershell and Batch inspired from Get File Version in PowerShell :
我假设是“产品版本”字段,它在您要寻找的exe-File的“属性对话框”的详细信息选项卡中显示。
这就是
c:\ windows \ system32 \ Notepad.exe
:在qwertys上构建对原始问题的评论,您无法获得'产品版本',唯一的“文件版本”(即''版本')使用
wmic
。使用 notpad.exe 作为示例
,下面显示了如何列出可以查询使用wmic 的所有值,
可以使用powerShell检索“产品版本”字段这:
如果要使用批处理,则将面临将值重新作为批处理脚本中的变量的挑战。看起来这个答案描述了如何做到这一点:如何将变量从powershell传递到批处理变量
I am assuming that it is the 'Product version' field which is shown in the Details tab of the Properties dialog for the exe-file you are looking for.
This is what it looks like for
C:\Windows\System32\notepad.exe
:Building on Qwertys comment to the original question, you can't get 'Product version' , only 'File version' (i.e. 'Version') using
wmic
.Using notpad.exe as an example
The example below shows how to list all values that can be queried for using
wmic
,The 'Product version' field can be retrieved with Powershell like this:
If you want to use batch-script you will have the challenge of getting the value back as a variable in your batch script. Looks like this answer describes how to do that: how to pass variable from PowerShell to batch variable