How to use nodejs to run .bat file

existing make.bat files for processing pictures. You need nodejs to call make.bat and pass in the image file. Excuse me, how can it be realized?

Apr.19,2022

almost forgot the difference between platforms.. If you just want to run .bat files on windows, you can take a look at this section of the document.

can use child_process.spawn () with the shell option set, or use child_process.exec (), or derive cmd.exe and pass in .bat or .cmd files as parameters (that is, what the shell option and child_process.exec () do).

here is the document link.


can be used if you can call cmd.exe.

Menu