You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何从命令提示符正确获取Windows环境下nmake的版本?

How to Correctly Retrieve NMAKE Version from the Command Line (VS 2017 x64 Native Tools Command Prompt)

I get where you're coming from—trying to run nmake _NMAKE_VER gives you the version string but also throws that annoying U1073 error, right? The issue here is that NMAKE interprets _NMAKE_VER as a target file it needs to build, hence the fatal error, even though it does spit out the version info first.

Here are two clean ways to get the version without any errors:

Method 1: Print the Macro Directly via Command Line

Use NMAKE's command-line flags to execute an echo command that outputs the _NMAKE_VER macro value. Run this:

nmake /E /C "@echo %_NMAKE_VER%"

Breakdown of the flags:

  • /E: Ensures built-in macros like _NMAKE_VER are properly resolved
  • /C: Suppresses extra NMAKE status output, so you only get the clean version string (like 14.16.27026.1)

Method 2: Use a Temporary Makefile Snippet

If you want more control over the output format, create a quick temporary file (let's call it version.mak) with this content:

!message NMAKE Version: $(_NMAKE_VER)

Then run:

nmake /f version.mak

You'll see a harmless warning about no target specified, but it will clearly print the version string without fatal errors.

One quick note: The version string you saw (Microsoft (R) Program Maintenance Utility Version 14.16.27026.1) is exactly NMAKE's version. The 14.1 maps to VS 2017's toolset (v141), and the 16 is the update build number—_NMAKE_VER just gives you this core version string directly.

内容的提问来源于stack exchange,提问作者sdbbs

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.12 05:27:42