Monday, May 01, 2017

FIXED - 'wmic' is not recognized as an internal or external command

I was getting this error, on a common Windows Management Interface C(?)ommand, wmic, as in wmic.exe.

Don't get worried the file still exists, you probably just messed your PATH variable up like me.
Execute this command:
set PATH=%PATH%;%SystemRoot%\System32\Wbem
Then you can execute wmic as per normal. To make this setting persist, you have to add this path:
%SystemRoot%\System32\Wbem (aka C:\Windows\System32\Wbem
into the Environment Variables section of Windows System / Advanced system settings / Advanced tab / Environment Variables... (button on the bottom). Add the path to the System variables section (bottom half). Just tack it on the end to whatevers there using ; to seperate. (or your user only if you want).

Anyway for all this typing, the WMIC command is very useful and you can have some fun with all its commands. Its useful for scripting as well. Here is a what I was after:

> qfe list
(wmic qfe list)

No comments: