Categories
JavaScript Answers

How to execute an exe file using Node?

Spread the love

To execute an exe file using Node, we use the execfile method.

For instance, we write

const exec = require("child_process").execFile;

exec("hello.exe", (err, data) => {
  console.log(err);
  console.log(data.toString());
});

to call exec run to hello.exe.

We get the output from data and errors from err in the callback.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *