wmic added default windows path (windows)

This commit is contained in:
Sebastian Hildebrandt 2020-11-27 16:05:56 +01:00
parent 5093145506
commit c6fccc0513
4 changed files with 11 additions and 3 deletions

View File

@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 4.30.6 | 2020-11-27 | wmic added default windows path (windows) |
| 4.30.5 | 2020-11-26 | adapted security update (prototype pollution prevention) |
| 4.30.4 | 2020-11-25 | reverted Object.freeze because it broke some projects |
| 4.30.3 | 2020-11-25 | security update (prototype pollution prevention) Object.freeze |

View File

@ -83,6 +83,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">4.30.6</th>
<td>2020-11-27</td>
<td><span class="code">wmic</span> added default windows path</td>
</tr>
<tr>
<th scope="row">4.30.5</th>
<td>2020-11-26</td>

View File

@ -168,7 +168,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.30.5</span></div>
<div class="version">Current Version: <span id="version">4.30.6</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

@ -33,6 +33,8 @@ let _cores = 0;
let wmicPath = '';
let codepage = '';
const WINDIR = process.env.WINDIR || 'C:\\Windows';
const execOptsWin = {
windowsHide: true,
maxBuffer: 1024 * 20000,
@ -295,7 +297,7 @@ function findObjectByKey(array, key, value) {
function getWmic() {
if (os.type() === 'Windows_NT' && !wmicPath) {
wmicPath = process.env.WINDIR + '\\system32\\wbem\\wmic.exe';
wmicPath = WINDIR + '\\system32\\wbem\\wmic.exe';
if (!fs.existsSync(wmicPath)) {
try {
const wmicPathArray = execSync('WHERE WMIC').toString().split('\r\n');
@ -317,7 +319,7 @@ function wmic(command, options) {
return new Promise((resolve) => {
process.nextTick(() => {
try {
exec(process.env.WINDIR + '\\system32\\chcp.com 65001 | ' + getWmic() + ' ' + command, options, function (error, stdout) {
exec(WINDIR + '\\system32\\chcp.com 65001 | ' + getWmic() + ' ' + command, options, function (error, stdout) {
resolve(stdout, error);
}).stdin.end();
} catch (e) {