The term ‘nmake’ is not recognized

I do something wrong but I do not know what. I have a PowerShell script, where I have a variable like this:

$VCVARSALLBAT = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"

Now, in this script I want to call this vcvarsall.bat doing this:

& "$($VCVARSALLBAT)" x86_amd64

From the output I see, it ran. After calling vcvarsall.bat, I call nmake.

I.e. my script looks like this:

$VCVARSALLBAT = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"
& "$($VCVARSALLBAT)" x86_amd64
nmake

I get this error message:

nmake : The term 'nmake' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At ...:214 char:1
+ nmake
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (nmake:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : CommandNotFoundException

The odd thing is this: When I go into normal command line of Windows and calling the following statements, I can call nmake without errors:

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
nmake

Leave a Comment