wmic path fix - windows
This commit is contained in:
+12
-6
@@ -221,12 +221,18 @@ function findObjectByKey(array, key, value) {
|
||||
|
||||
function getWmic() {
|
||||
if (os.type() === 'Windows_NT' && !wmicPath) {
|
||||
try {
|
||||
wmicPath = execSync('WHERE WMIC').toString().trim();
|
||||
} catch (e) {
|
||||
if (fs.existsSync(process.env.WINDIR + '\\system32\\wbem\\wmic.exe')) {
|
||||
wmic = process.env.WINDIR + '\\system32\\wbem\\wmic.exe';
|
||||
} else wmicPath = 'wmic';
|
||||
wmicPath = process.env.WINDIR + '\\system32\\wbem\\wmic.exe';
|
||||
if (!fs.existsSync(wmicPath)) {
|
||||
try {
|
||||
const wmicPathArray = execSync('WHERE WMIC').toString().split('\r\n');
|
||||
if (wmicPathArray && wmicPathArray.length) {
|
||||
wmicPath = wmicPathArray[0];
|
||||
} else {
|
||||
wmicPath = 'wmic';
|
||||
}
|
||||
} catch (e) {
|
||||
wmicPath = 'wmic';
|
||||
}
|
||||
}
|
||||
}
|
||||
return wmicPath;
|
||||
|
||||
Reference in New Issue
Block a user