'Launching external application from NodeJS

How can i mimic the action of double-clicking the application (.exe) on the desktop with nodejs, knowing the path to the exe. I want to launch the application and it remain open even after i close the the Nodejs application that launched it.

I've tried a bunch of options but they all seem to have issues not showing the applications native popup window. Which makes me believe it's an issue with the way im launching it from nodejs.

export function testExecute() {
  const command =
    "C:/Program Files/Side Effects Software/Houdini 18.5.633/bin/happrentice.exe";
  const cmd = `"${command}"`;
   
  // OPTION 1: Applications built in console doesn't show when launching
  exec(cmd).unref();
  
  // OPTION 2: Applications built in console doesn't show when launching either
  spawn(cmd, [], {
    detached: true,
    shell: true,
    stdio: ["ignore", "ignore", "ignore"],
  });
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source