Fix wmic is not recognized as an internal or external command operable program or batch file

This sneppet guides you on how resolve command prompt or powershell error ‘wmic.exe’ is not recognized as an internal or external command, operable program or batch file.

The WMI command-line [WMIC] utility provides a command-line interface for Windows Management Instrumentation [WMI]. WMIC will work well with existing shells and utility commands.

If wmic utility is not found in your PATH, then you might get the following error.

C:\> wmic

'wmic' is not recognized as an internal or external command,
operable program or batch file.

C:\> echo %PATH%

C:\Program Files\Java\openjdk-9.0.4\bin;.;C:\Program Files\apache-maven\bin;.;C:\Program Files\WSO2\Enterprise
Integrator.4.0\bin;.;C:\Windows\System32;.;C:\Program Files\nodejs\;C:\Users\nithip\AppData\Roaming\npm

Set wmic.exe utility directory in PATH

To set WMI Command-line [WMIC] utility directory in PATH environment variable, you need to add the following entry C:\Windows\System32\wbem in the PATH.

Note, either you can add this entry via Advanced system settings link -> Environment Variables -> System Variables -> PATH environment variable from control panel in case of Windows 8 and Windows 10, via Computer icon -> Properties -> Advanced system settings -> Environment Variables -> System Variables -> PATH in case of Windows 7 to set path.

[or] 

You can set path via command line as shown below.

C:\> set path=%PATH%;C:\Windows\System32\wbem;

C:\> echo %PATH%

C:\Program Files\Java\openjdk-9.0.4\bin;.;C:\Program Files\apache-maven\bin;.;C:\Program Files\WSO2\Enterprise
Integrator.4.0\bin;.;C:\Windows\System32;.;C:\Program Files\nodejs\;C:\Users\nithip\AppData\Roaming\npm;C:\Windows\System32\wbem;

C:\> wmic
wmic:root\cli >

Using WMIC.exe help utility

Windows Management Instrumentation [WMI] is the Microsoft implementation of Web-Based Enterprise Management [WBEM], which is an industry initiative to develop a standard technology for accessing management information in an enterprise environment.

WMI uses the Common Information Model [CIM] industry standard to represent systems, applications, networks, devices, and other managed components.

WMIC includes online help at the command line. First, at the command prompt type wmic to start the WMIC shell and then type /? at any level to display list of alias and syntax.

C:\> wmic

wmic:root\cli>/?

[global switches] 

The following global switches are available:
/NAMESPACE           Path for the namespace the alias operate against.
/ROLE                Path for the role containing the alias definitions.
/NODE                Servers the alias will operate against.
/IMPLEVEL            Client impersonation level.
/AUTHLEVEL           Client authentication level.
/LOCALE              Language id the client should use.
/PRIVILEGES          Enable or disable all privileges.
/TRACE               Outputs debugging information to stderr.
/RECORD              Logs all input commands and output.
/INTERACTIVE         Sets or resets the interactive mode.
/FAILFAST            Sets or resets the FailFast mode.
/USER                User to be used during the session.
/PASSWORD            Password to be used for session login.
/OUTPUT              Specifies the mode for output redirection.
/APPEND              Specifies the mode for output redirection.
/AGGREGATE           Sets or resets aggregate mode.
/AUTHORITY           Specifies the  for the connection.
/?[:]    Usage information.

For more information on a specific global switch, type: switch-name /?


The following alias/es are available in the current role:
ALIAS                    - Access to the aliases available on the local system
BASEBOARD                - Base board [also known as a motherboard or system board] management.
BIOS                     - Basic input/output services [BIOS] management.
BOOTCONFIG               - Boot configuration management.
CDROM                    - CD-ROM management.
COMPUTERSYSTEM           - Computer system management.
CPU                      - CPU management.
CSPRODUCT                - Computer system product information from SMBIOS.
DATAFILE                 - DataFile Management.
DCOMAPP                  - DCOM Application management.
DESKTOP                  - User's Desktop management.
DESKTOPMONITOR           - Desktop Monitor management.
DEVICEMEMORYADDRESS      - Device memory addresses management.
DISKDRIVE                - Physical disk drive management.
DISKQUOTA                - Disk space usage for NTFS volumes.
DMACHANNEL               - Direct memory access [DMA] channel management.
ENVIRONMENT              - System environment settings management.
FSDIR                    - Filesystem directory entry management.
GROUP                    - Group account management.
IDECONTROLLER            - IDE Controller management.
IRQ                      - Interrupt request line [IRQ] management.
JOB                      - Provides  access to the jobs scheduled using the schedule service.
LOADORDER                - Management of system services that define execution dependencies.
LOGICALDISK              - Local storage device management.
LOGON                    - LOGON Sessions.
MEMCACHE                 - Cache memory management.
MEMORYCHIP               - Memory chip information.
MEMPHYSICAL              - Computer system's physical memory management.
NETCLIENT                - Network Client management.
NETLOGIN                 - Network login information [of a particular user] management.
NETPROTOCOL              - Protocols [and their network characteristics] management.
NETUSE                   - Active network connection management.
NIC                      - Network Interface Controller [NIC] management.
NICCONFIG                - Network adapter management.

Further, to display options available for specific alias let’s say process, you need type the following from WMIC CLI.

wmic:root\cli>process/?

PROCESS - Process management.

HINT: BNF for Alias usage.
[ [WMIObject] |  [] | [] ] [].

USAGE:

PROCESS ASSOC []
PROCESS CALL  []
PROCESS CREATE 
PROCESS DELETE
PROCESS GET [] []
PROCESS LIST [] []

Also See:

  • Set Windows PowerShell Environment Variables
  • How to change drive and the directory in Windows PowerShell ?
  • Visual Studio Code change Terminal from powershell to cmd
  • Not recognized as an internal or external command ‘ionic’

References:

  • wmic
  • microsoft docs

Why is WMIC not working?

If the WMI Service is already running or if after starting the WMI Service, the error still persists, the problem is occurring because the WMIC program is not available in the system path. To fix the issue, you have to add the path where the WMIC executable is located to the System Variable.

How do you fix CMD is not recognized as an internal or external command?

We have listed fixes for both versions of the error, so follow the relevant one to your case..
Verify if the Program Is Installed. ... .
Use the Full File Path to Execute the Command. ... .
Use the Full File Path Within Double Quotes. ... .
Add the File Path to the Windows Environment Variables. ... .
Move Files to System32 Folder..

How do I install WMIC on Windows?

Please follow the steps below to download and properly replace you file:.
Locate your Windows operating system version in the list of below "Download WMIC.exe Files"..
Click the appropriate "Download Now" button and download your Windows file version..
Copy the file into the appropriate directory for your Windows version:.

What is the replacement for WMIC?

The WMIC tool is deprecated in Windows 10, version 21H1 and the 21H1 General Availability Channel release of Windows Server. This tool is superseded by Windows PowerShell for WMI.

Chủ Đề