Find Windows core executables like cscript
, preferring the native 64-bit version regardless of Node.js bitness. Because by default, when running 32-bit Node.js, Windows would redirect to 32-bit WoW64 executables.
const bin = require('windows-bin')
// C:\Windows\Sysnative\cscript.exe
bin('cscript', function(err, path) {
console.log(path)
})
// C:\Windows\system32\cscript.exe
bin('cscript', { native: false }, function(err, path) {
console.log(path)
})
With npm do:
npm install windows-bin