rannn505 / child-shell

Node.js bindings 🔗 for shell
http://rannn505.github.io/child-shell/
MIT License
299 stars 71 forks source link

PS_CMD_FAIL_ERROR: Error code = 0x80005000 #138

Open Genp0 opened 3 years ago

Genp0 commented 3 years ago

image

image

when I invoke a command, the string was recognized correctly. then it throws an error which is "PS_CMD_FAIL_ERROR: Error code = 0x80005000" cloud you please to tell me how to solve it.

brunomartinspro commented 3 years ago

In my case i solved with this:

const  Shell = require("node-powershell");
const  { PSCommand }  = require("node-powershell");

const ps = new Shell({
  executionPolicy: 'Bypass',
  noProfile: true
});

// Execute Script
let script = new PSCommand(`& "${require('path').resolve(__dirname, 'MYSCRIPT.ps1')}"`);

ps.addCommand(script);