Hi,
I'm trying to take advantage of the wmic.exe tool via nodejs but have encountered a strange behaviour of the tool. My desire is to spawn a single wmic.exe process (no arguments), so it starts in interactive mode, then using the stdin pipe I can send multiple queries without having to restart a new process each time.
Unfortunately it refuses to respond (I get nothing via stdout) unless I do one of the following:
- Have a null stdin.
- Fire an end() on the stdin pipe.
- Send a ctrl-z (\x1a) control code to stdin.
If I do one of the above, it'll respond but then after providing the prompt back via stdout, it ends the process.
It also has a similar behaviour in nodejs when using .exec() where it won't respond unless there's a redirection to null for the stdin. E.g. "wmic < nul".
Does anyone know much about wmic.exe and this weird behaviour?
Cheers
Dave