wmic path detection (windows)

This commit is contained in:
Sebastian Hildebrandt
2019-03-24 20:11:54 +01:00
parent d110419c4f
commit 6fcf575ad5
5 changed files with 20 additions and 11 deletions
+7 -3
View File
@@ -221,9 +221,13 @@ function findObjectByKey(array, key, value) {
function getWmic() {
if (os.type() === 'Windows_NT' && !wmic) {
if (fs.existsSync(process.env.WINDIR + '\\system32\\wbem\\wmic.exe')) {
wmic = process.env.WINDIR + '\\system32\\wbem\\wmic.exe';
} else wmic = 'wmic';
try {
wmic = 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 wmic = 'wmic';
}
}
return wmic;
}