const Shell = require("node-powershell");
const pwsh = new Shell({
executionPolicy: "Bypass",
noProfile: true
});
let cmd_statement1 = 'echo "Hello node and powershell"';
let cmd_statement2 = 'ls';
pwsh.addCommand(cmd_statement1);
pwsh.addCommand(cmd_statement2);
pwsh.invoke()
.then((result) => {
console.log(result);
})
.then(() => {
pwsh.dispose();
})
.catch(err =>{
console.log(err);
pwsh.dispose();
})