mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-16 06:31:04 +00:00
arguments
is reserved word. change to commandOptions
This commit is contained in:
parent
a98b1fcf4c
commit
daf2ae2571
|
@ -20,37 +20,37 @@ exports.addslashes = function(string) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.execScript = function(scriptName, args) {
|
exports.execScript = function(scriptName, args) {
|
||||||
var arguments = [];
|
var commandOptions = [];
|
||||||
|
|
||||||
arguments.push("powershell.exe");
|
commandOptions.push("powershell.exe");
|
||||||
arguments.push("-NoProfile");
|
commandOptions.push("-NoProfile");
|
||||||
arguments.push("-ExecutionPolicy");
|
commandOptions.push("-ExecutionPolicy");
|
||||||
arguments.push("ByPass");
|
commandOptions.push("ByPass");
|
||||||
arguments.push("-nologo")
|
commandOptions.push("-nologo")
|
||||||
arguments.push("-file");
|
commandOptions.push("-file");
|
||||||
arguments.push(scriptName + ".ps1");
|
commandOptions.push(scriptName + ".ps1");
|
||||||
|
|
||||||
if(typeof(args) !== "undefined") {
|
if(typeof(args) !== "undefined") {
|
||||||
for(var i in args) {
|
for(var i in args) {
|
||||||
arguments.push(args[i]);
|
commandOptions.push(args[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SHELL.exec(arguments.join(' '));
|
return SHELL.exec(commandOptions.join(' '));
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.execCommand = function(command) {
|
exports.execCommand = function(command) {
|
||||||
var arguments = [];
|
var commandOptions = [];
|
||||||
|
|
||||||
arguments.push("powershell.exe");
|
commandOptions.push("powershell.exe");
|
||||||
arguments.push("-NoProfile");
|
commandOptions.push("-NoProfile");
|
||||||
arguments.push("-ExecutionPolicy");
|
commandOptions.push("-ExecutionPolicy");
|
||||||
arguments.push("ByPass");
|
commandOptions.push("ByPass");
|
||||||
arguments.push("-nologo")
|
commandOptions.push("-nologo")
|
||||||
arguments.push("-Command");
|
commandOptions.push("-Command");
|
||||||
arguments.push("\"& {");
|
commandOptions.push("\"& {");
|
||||||
arguments.push(exports.addslashes(command));
|
commandOptions.push(exports.addslashes(command));
|
||||||
arguments.push("}\"");
|
commandOptions.push("}\"");
|
||||||
|
|
||||||
return SHELL.exec(arguments.join(' '));
|
return SHELL.exec(commandOptions.join(' '));
|
||||||
};
|
};
|
||||||
|
|
35
uriloader.js
35
uriloader.js
|
@ -22,40 +22,47 @@ return {
|
||||||
if(pos < 0) {
|
if(pos < 0) {
|
||||||
console.log("Not vaild URI");
|
console.log("Not vaild URI");
|
||||||
} else {
|
} else {
|
||||||
var queryString = uri.substring(pos + 4);
|
var commandOptions = [],
|
||||||
var query = this.parseQuery(queryString);
|
queryString = uri.substring(pos + 4),
|
||||||
var application = query['application'];
|
query = this.parseQuery(queryString);
|
||||||
var argument = query['argument'];
|
|
||||||
var filename;
|
|
||||||
|
|
||||||
switch(application) {
|
if(!query.application) {
|
||||||
|
query.application = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(query.application) {
|
||||||
case "app":
|
case "app":
|
||||||
filename = "app.hta";
|
commandOptions.push("app.hta");
|
||||||
break;
|
break;
|
||||||
case "mscalc":
|
case "mscalc":
|
||||||
filename = "calc";
|
commandOptions.push("calc");
|
||||||
break;
|
break;
|
||||||
case "msie":
|
case "msie":
|
||||||
filename = "%PROGRAMFILES%\\Internet Explorer\\iexplore.exe";
|
commandOptions.push("\"%PROGRAMFILES%\\Internet Explorer\\iexplore.exe\"");
|
||||||
|
commandOptions.push("https://github.com/gnh1201/welsonjs");
|
||||||
break;
|
break;
|
||||||
case "msexcel":
|
case "msexcel":
|
||||||
filename = "%PROGRAMFILES%\\Microsoft Office\\Office15\\EXCEL.EXE";
|
commandOptions.push("\"%PROGRAMFILES%\\Microsoft Office\\Office15\\EXCEL.EXE\"");
|
||||||
break;
|
break;
|
||||||
case "mspowerpoint":
|
case "mspowerpoint":
|
||||||
filename = "%PROGRAMFILES%\\Microsoft Office\\Office15\\POWERPNT.EXE";
|
commandOptions.push("\"%PROGRAMFILES%\\Microsoft Office\\Office15\\POWERPNT.EXE\"");
|
||||||
break;
|
break;
|
||||||
case "msword":
|
case "msword":
|
||||||
filename = "%PROGRAMFILES%\\Microsoft Office\\Office15\\WINWORD.EXE";
|
commandOptions.push("\"%PROGRAMFILES%\\Microsoft Office\\Office15\\WINWORD.EXE\"");
|
||||||
break;
|
break;
|
||||||
case "msaccess":
|
case "msaccess":
|
||||||
filename = "%PROGRAMFILES%\\Microsoft Office\\Office15\\MSACCESS.EXE";
|
commandOptions.push("\"%PROGRAMFILES%\\Microsoft Office\\Office15\\MSACCESS.EXE\"");
|
||||||
break;
|
break;
|
||||||
dafault:
|
dafault:
|
||||||
console.log("Unknown application");
|
console.log("Unknown application");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL.run("\"" + filename + "\"" + " " + argument);
|
if(typeof(query.argument) !== "undefined") {
|
||||||
|
commandOptions.push(query.argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
SHELL.run(commandOptions.join(' '));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user