This commit is contained in:
Namhyeon Go 2020-07-23 19:35:53 +09:00
parent be70c01671
commit a200c51364
2 changed files with 18 additions and 8 deletions

24
app.js
View File

@ -69,16 +69,24 @@ var console = {
} }
}; };
if(typeof(GetObject) !== "function") { if(typeof(CreateObject) !== "function") {
function GetObject(pathName, className) { var CreateObject = function(className) {
console.warn("Not supported function GetObject() in GUI mode"); return new ActiveXObject(className);
}; }
} }
if(typeof(CreateObject) !== "function") { if(typeof(GetObject) !== "function") {
function CreateObject(className) { var GetObject = function(pathName, className) {
return new ActiveXObject(className); var paths = pathName.split("\\");
}; if(paths[0].indexOf("winmgmts:") > -1) {
var objLocator = CreateObject("WbemScripting.SWbemLocator");
var strComputer = paths[2];
var strNamespace = paths.slice(3).join("\\");
return objLocator.ConnectServer(strComputer, strNamespace);
} else {
console.log("Not supported: " + pathName);
}
}
} }
function require(FN) { function require(FN) {

View File

@ -63,6 +63,8 @@ return {
} }
SHELL.run(commandOptions.join(' ')); SHELL.run(commandOptions.join(' '));
return 0;
} }
} }
} }