Update powershell.js

This commit is contained in:
Namhyeon Go 2023-03-10 11:43:35 +09:00 committed by GitHub
parent aed2ab6e04
commit 401cb4296e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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");
};
}