Powershell aus NodeJS zu nennen habe ich diese Powershell, die ich in der Regel wie folgt aufrufen:Nicht in der Lage
powershell -ExecutionPolicy Bypass -File "D:\tmp\getmember2.ps1" -groupnames "ABC"
Jetzt muss ich aus meiner NodeJS nennen. Also, das ist, was ich schaffen:
var spawn = Meteor.npmRequire("child_process").spawn;
child = spawn("powershell.exe",["-ExecutionPolicy ByPass -File d:\\tmp\\getmember2.ps1 -groupnames \"ABC\""]);
child.stdout.on("data",function(data){
console.log("Powershell Data: " + data);
});
child.stderr.on("data",function(data){
console.log("Powershell Errors: " + data);
});
child.on("exit",function(){
console.log("Powershell Script finished");
});
child.stdin.end();
Jedoch habe ich diesen Fehler bin immer:
I20170222-16:58:25.257(8)? API started
I20170222-16:58:26.175(8)? Powershell Errors: At line:1 char:2
I20170222-16:58:26.174(8)?
I20170222-16:58:26.175(8)? + CategoryInfo : ParserError: (-:String)
[], ParentContainsErrorR
I20170222-16:58:26.175(8)? + - <<<< ExecutionPolicy ByPass -File d:\tmp\getmember2.ps1
I20170222-16:58:26.176(8)? Powershell Errors: ecordException
I20170222-16:58:26.176(8)? Powershell Errors: + FullyQualifiedErrorId : MissingExpressionAfterOperator
I20170222-16:58:26.176(8)? Powershell Errors:
I20170222-16:58:26.177(8)?
I20170222-16:58:26.174(8)? Powershell Errors: Missing expression after unary operator '-'.
I20170222-16:58:26.259(8)? Powershell Script finished
Jede Idee, warum es nicht funktioniert?