node.js execfile child process

Srilalitha vishnubhotla
Srilalitha vishnubhotla used Ask the Experts™
on
execFile(script, (error1, stdout1, stderr1) => {
                        if (error1 || stderr1) {
                            logger.error(script);
                            logger.error("+++++++++++" + error1  );
                            reject(false);
                        }
                        if (stdout1) {
                            logger.info(script);
                            resolve(true);
                        }
                    });

Open in new window


when the script is log/getdata.bat
'log'is not recognized as an internal or external command, Pls suggest
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Running on Windows? Then at least log\getdata.bat. Note that the command does not spawn a shell, so I would have started cmd.exe and have passed the script as an arg and set cwd to the required directory.

https://nodejs.org/api/child_process.html#child_process_child_process_execfile_file_args_options_callback

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial