From 6fcf575ad5ab51f9abb789ce10a3bc8b1eb579ba Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Sun, 24 Mar 2019 20:11:54 +0100 Subject: [PATCH] wmic path detection (windows) --- CHANGELOG.md | 9 +++++---- README.md | 1 - docs/history.html | 7 ++++++- docs/index.html | 4 ++-- lib/util.js | 10 +++++++--- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b732675..69f912d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,7 +30,8 @@ For major (breaking) changes - version 3 and 2 see end of page. | Version | Date | Comment | | -------------- | -------------- | -------- | -| 4.1.2 | 2019-03-23 | updated dics | +| 4.1.3 | 2019-03-24 | wmic path detection (windows) | +| 4.1.2 | 2019-03-23 | updated docs | | 4.1.1 | 2019-03-13 | updated typescript typings | | 4.1.0 | 2019-03-13 | `versions()` added pip, pip3 | | 4.0.16 | 2019-03-12 | Happy birthday - 5th aniversary | @@ -108,7 +109,7 @@ For major (breaking) changes - version 3 and 2 see end of page. | 3.42.2 | 2018-07-03 | `users()` optimized results if lack of permissions | | 3.42.1 | 2018-07-03 | `versions()` bugfix git version macOS | | 3.42.0 | 2018-06-01 | `processes()` added parent process PID | -| 3.41.4 | 2018-05-28 | windows exec WMIC in try catch | +| 3.41.4 | 2018-05-28 | windows exec WMIC path detection (windows) in try catch | | 3.41.3 | 2018-05-13 | improved SunOS support `getStaticData()`, `getDynamicData()` | | 3.41.2 | 2018-05-13 | bugfix `system()` and `flags()` Raspberry Pi | | 3.41.1 | 2018-05-11 | updated docs | @@ -139,8 +140,8 @@ For major (breaking) changes - version 3 and 2 see end of page. | 3.33.13 | 2018-01-12 | bugfix `memLayout()` (Windows) | | 3.33.12 | 2017-12-25 | fixed typos | | 3.33.11 | 2017-12-17 | updated docs | -| 3.33.10 | 2017-12-14 | bugfix WMIC blockDevice parse (Windows 7) | -| 3.33.9 | 2017-12-14 | bugfix WMIC not found (Windows) | +| 3.33.10 | 2017-12-14 | bugfix WMIC path detection (windows) blockDevice parse (Windows 7) | +| 3.33.9 | 2017-12-14 | bugfix WMIC path detection (windows) not found (Windows) | | 3.33.8 | 2017-12-02 | bugfix diskLayout().size (OSX) | | 3.33.7 | 2017-11-28 | bugfix diskLayout().size | | 3.33.6 | 2017-11-16 | bugfix diskLayout().size | diff --git a/README.md b/README.md index dab3b7c..b2ce432 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,6 @@ si.cpu() - Version 3.52.0: `cpu()` added physical cores, processors, socket type - Version 3.51.0: `processLoad()` added for windows - Version 3.50.0: `services()` added possibility to specify ALL services "*" for linux/win -- Version 3.49.0: `uuid()` added - os specific uuid (per installation) - ... You can find all changes here: [detailed changelog][changelog-url] diff --git a/docs/history.html b/docs/history.html index 09bad02..4618f5e 100644 --- a/docs/history.html +++ b/docs/history.html @@ -80,10 +80,15 @@ + + 4.1.3 + 2019-03-24 + wmic path detection (windows) + 4.1.2 2019-03-23 - updated dics + updated docs 4.1.1 diff --git a/docs/index.html b/docs/index.html index 1d88b62..b4c096f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
-
Current Version: 4.1.2
+
Current Version: 4.1.3
@@ -201,7 +201,7 @@
Downloads last month
-
139
+
141
Dependends
diff --git a/lib/util.js b/lib/util.js index 815d4a2..d43be94 100644 --- a/lib/util.js +++ b/lib/util.js @@ -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; }