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;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.exec = function(args) {
|
this.build = function(args) {
|
||||||
if (this.execType != "ps1") {
|
if (this.execType != "ps1") {
|
||||||
console.warn("The execType is not set 'ps1'. Will be forward it to the default shell.");
|
console.warn("The execType is not set 'ps1'. Will be forward it to the default shell.");
|
||||||
SHELL.exec(this.target);
|
return SHELL.build(this.target);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// default arguments
|
|
||||||
var cmd = [
|
var cmd = [
|
||||||
"powershell.exe",
|
"powershell.exe",
|
||||||
"-NoProfile",
|
"-NoProfile",
|
||||||
"-ExecutionPolicy",
|
"-ExecutionPolicy",
|
||||||
"ByPass",
|
"ByPass",
|
||||||
"-nologo"
|
"-nologo"
|
||||||
];
|
]; // default arguments
|
||||||
|
|
||||||
switch (this.dataType) {
|
switch (this.dataType) {
|
||||||
case 3: // dataType: URL(3)\
|
case 3: // dataType: URL(3)\
|
||||||
|
@ -115,16 +113,15 @@ var PowershellObject = function() {
|
||||||
cmd = cmd.concat(args);
|
cmd = cmd.concat(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SHELL.exec(cmd);
|
return cmd;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.runAs = function() {
|
this.exec = function(args) {
|
||||||
if (this.execType != "ps1") {
|
return SHELL.exec(this.build(args));
|
||||||
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 {
|
this.runAs = function(args) {
|
||||||
return this.exec("Start-Process cmd \"/q /c " + SHELL.addslashes(SHELL.build(cmd)) + "\" -Verb RunAs");
|
return this.exec("Start-Process cmd \"/q /c " + SHELL.addslashes(this.build(args)) + "\" -Verb RunAs");
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user