NMake returns error when using $(shell)


I’m new to nmake and needing to modify a build script. I want to execute a command and capture the result in a variable that will then be used throughout the script. However when attempting to use the shell command I receive the following error message:

I put together a one line script to test the shell command.


Here’s the version of nmake being used:

Does nmake support the shell command?
Is there another option in nmake to execute a command and capture the result?


It is possible to read another programs output into nmake variable using temporay files if the output contains a single line of text. It is also possible to use external scripts to modify multiple line outputs and make this solution work. An example to read a single line output to nmake variable:

This [for execution] is used to execute some commands and compare the return code of the program. It is done during pre-processing. After tha a hack described here “Can’t figure out how to read file from nmake” is used to read a single line from temporary file.


NMake returns error when using $(shell) by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply