How to launch cmd by .js file and automatically type some commands in it?
const { exec } = require("child_process");
const open = require("open");
const readline = require("readline").createInterface({
input: process.stdin,
output: process.stdout,
});
readline.question("Launch cmd?", async (name) => {
if (name === "Y") {
await open("cmd.exe", { wait: true }); //how i can write something in cmd?
} else {
process.exit(console.log("You have closed the programm"));
}
});