wmic path fix - windows

This commit is contained in:
Sebastian Hildebrandt 2019-05-29 19:50:45 +02:00
parent 980828f00e
commit bd842b20a4
4 changed files with 20 additions and 7 deletions

View File

@ -30,6 +30,8 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 4.6.1 | 2019-05-29 | get wmic path - fic windows |
| 4.6.0 | 2019-05-27 | added `dockerInfo()` |
| 4.5.1 | 2019-05-17 | updated docs |
| 4.5.0 | 2019-05-17 | `fsOpenFiles()` added open file descriptor count |
| 4.4.1 | 2019-05-11 | updated docs |

View File

@ -80,6 +80,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">4.6.1</th>
<td>2019-05-29</td>
<td><span class="code">wmic</span> path fix - windows</td>
</tr>
<tr>
<th scope="row">4.6.0</th>
<td>2019-05-27</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span></div>
<div class="version">Current Version: <span id="version">4.6.0</span></div>
<div class="version">Current Version: <span id="version">4.6.1</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">

View File

@ -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;