mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-11 00:15:14 +00:00
Update powershell.js
This commit is contained in:
parent
dedfbbefea
commit
37ce425a1c
|
@ -6,6 +6,17 @@ var scope = {
|
||||||
require: global.require
|
require: global.require
|
||||||
};
|
};
|
||||||
|
|
||||||
|
scope.addslashes = function(string) {
|
||||||
|
return string.replace(/\\/g, '\\\\').
|
||||||
|
replace(/\u0008/g, '\\b').
|
||||||
|
replace(/\t/g, '\\t').
|
||||||
|
replace(/\n/g, '\\n').
|
||||||
|
replace(/\f/g, '\\f').
|
||||||
|
replace(/\r/g, '\\r').
|
||||||
|
replace(/'/g, '\\\'').
|
||||||
|
replace(/"/g, '\\"');
|
||||||
|
}
|
||||||
|
|
||||||
scope.execScript = function(scriptName, args) {
|
scope.execScript = function(scriptName, args) {
|
||||||
var arguments = [
|
var arguments = [
|
||||||
"powershell.exe",
|
"powershell.exe",
|
||||||
|
@ -26,4 +37,20 @@ scope.execScript = function(scriptName, args) {
|
||||||
return SHELL.exec(arguments.join(' '));
|
return SHELL.exec(arguments.join(' '));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
scope.execCommand = function(command) {
|
||||||
|
var arguments = [
|
||||||
|
"powershell.exe",
|
||||||
|
"-NoProfile",
|
||||||
|
"-ExecutionPolicy",
|
||||||
|
"ByPass",
|
||||||
|
"-nologo"
|
||||||
|
"-Command",
|
||||||
|
"\"& {",
|
||||||
|
scope.addslashes(command),
|
||||||
|
"}\""
|
||||||
|
];
|
||||||
|
|
||||||
|
return SHELL.exec(arguments.join(' '));
|
||||||
|
};
|
||||||
|
|
||||||
return scope;
|
return scope;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user