mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 15:04:58 +00:00
Update powershell.js
This commit is contained in:
parent
aed2ab6e04
commit
401cb4296e
|
@ -68,21 +68,19 @@ var PowershellObject = function() {
|
|||
return this;
|
||||
};
|
||||
|
||||
this.exec = function(args) {
|
||||
this.build = function(args) {
|
||||
if (this.execType != "ps1") {
|
||||
console.warn("The execType is not set 'ps1'. Will be forward it to the default shell.");
|
||||
SHELL.exec(this.target);
|
||||
return;
|
||||
return SHELL.build(this.target);
|
||||
}
|
||||
|
||||
// default arguments
|
||||
var cmd = [
|
||||
"powershell.exe",
|
||||
"-NoProfile",
|
||||
"-ExecutionPolicy",
|
||||
"ByPass",
|
||||
"-nologo"
|
||||
];
|
||||
]; // default arguments
|
||||
|
||||
switch (this.dataType) {
|
||||
case 3: // dataType: URL(3)\
|
||||
|
@ -115,16 +113,15 @@ var PowershellObject = function() {
|
|||
cmd = cmd.concat(args);
|
||||
}
|
||||
|
||||
return SHELL.exec(cmd);
|
||||
return cmd;
|
||||
};
|
||||
|
||||
this.runAs = function() {
|
||||
if (this.execType != "ps1") {
|
||||
console.warn("The execType is not set 'ps1'. Will be forward it to the default shell.");
|
||||
return this.exec("Start-Process cmd \"/q /c " + SHELL.addslashes(SHELL.build(this.target)) + "\" -Verb RunAs");
|
||||
} else {
|
||||
return this.exec("Start-Process cmd \"/q /c " + SHELL.addslashes(SHELL.build(cmd)) + "\" -Verb RunAs");
|
||||
}
|
||||
this.exec = function(args) {
|
||||
return SHELL.exec(this.build(args));
|
||||
};
|
||||
|
||||
this.runAs = function(args) {
|
||||
return this.exec("Start-Process cmd \"/q /c " + SHELL.addslashes(this.build(args)) + "\" -Verb RunAs");
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user