''.' is not recognized as an internal or external command, while the script doesnt contain any dots
I'm trying to make my discord bot run scripts/other bots on my computer with node.js child_process spawn.
I managed to make it run a script but even if the script only contains echo a it still throws
'.' is not recognized as an internal or external command
If it's helpful in any way, this is the code:
const proc = cp.spawn(`./scripts/${script}.bat`,[], {detached: true})
const pid = proc.pid;
console.log(pid);
message.channel.send(`PID: ${pid}`);
proc.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
proc.stderr.on('data', (data) => {
console.error(`stderr: ${data}`);
});
proc.on('close', (code) => {
console.log(`child process exited with code ${code}`);
});
And the result:
stderr: '.' is not recognized as an internal or external command, operable program or batch file.
child process exited with code 1
While the ${script}.bat looks like:
echo a
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
