Windows 7/8/10: WMIC commands and tips

[ad_1]
Shift lever between buttons © iStock.com/PRANGKUL RUANGSRI

With the powerful WMIC you can catch a glimpse under the PC / Windows cover. All of the tips in the article work on Windows 7, Windows 8.1, and Windows 10 (2004, May 2020 Update).

D.he abbreviation “WMIC” stands for “WMI Ccommand-line “- written out”W.indows M.management I.nstrumentation C.Command-line “. It is an on-board tool that can be addressed via a command interpreter such as the command line or PowerShell. Windows programmers elicit a wide range of information about it: Creating your own routines to check the wear and tear of a notebook battery is not an option necessary – they simply tap into WMIC. Even users who are neither interested nor interested in development benefit from WMIC: Its commands are quickly entered in a command line and do the same here as in batch scripts. So you don’t need any for the following tips Special knowledge: If you copy a command to the clipboard and paste it into a command line, Windows will output the required information. If you add a parameter to your command, write the output in a TXT text file, for example on the desktop With WMIC, for example, the anti-virus program installed on a PC or the installed Win bring the notebook battery wear and tear dows updates in experience.

WMIC commands for all users

The following WMIC commands will help every user. The section below gives tips for hobby batch programmers: After all, WMIC is primarily intended for experienced users who build appropriate routines into programs they have built themselves, for example for automation. WMIC is also attractive for others, but not absolutely necessary: ​​What it does, you can often do just as easily and more easily using the Windows graphical user interface. However, since WMIC would be dishonored to leave out the developer aspect, it is included in the article. Well first, tips for everyone: Press Windows-R and enter cmd to bring up the command line. Enter the desired WMIC command and confirm this with the Enter key. It is possible without any problems to enter several of the following commands one after the other and each with [Enter] send off.
Show running processes (including priority, PID, ThreadCount, WorkingSetSize): wmic process list brief or wmic process get ThreadCount, HandleCount, Name, Priority, ProcessId, WorkingSetSize Display processor name including clock rate: wmic cpu get name Show processor information: wmic cpu get Name, Caption, MaxClockSpeed, DeviceID, status Show processor load in percent: wmic cpu get loadpercentage Save operating system information on the desktop: wmic>% userprofile% Desktop PC-Info-Table.html os get / format: hform Show list of installed Windows updates: wmic qfe get Show installed antivirus program including path: wmic / namespace: \ root securitycenter2 path antivirusproduct GET displayName, pathToSignedProductExe Show autostart programs: wmic startup get Caption, Location, Command Show installed drivers wmic sysdriver get name or wmic sysdriver list instance Display the names and health status of the drives (internal / external): wmic diskdrive get caption, status Redirect WMIC command output to file: wmic qfe get>% userprofile% Desktop Update-List.txt or wmic diskdrive get caption, status>% userprofile% Desktop Drive-Health.txt The commands are examples, that is important >% AnyFilePath%. Redirect WMIC command output to clipboard: wmic qfe get | clip (It is a | clip to append) or wmic / output: clipboard qfe get The commands are examples, that is important | clip or / output: clipboard.

WMIC: adjust process priority

With WMIC you intervene in the execution of your programs: As an alternative to the Task Manager, you can use it to adjust the process priority to the accelerating “high”. Click on the following diagram to view it larger in the browser. To set a process to the highest possible level “real time” requires a previous call of the command line with administrator rights. Otherwise, you’re just bumping a process to high priority, which is second choice.
WMIC program windows show process priorities © COMPUTER BILD

WMIC also adjusts process priorities: how to lower and raise them to slow down or speed up a program. You can choose to use an internal number or (more self-explanatory) an English-language, speaking priority designation as a parameter.

Important note: If you follow a download link, you will see a red download button in the top left. If a new page opens after clicking on it, but no further button or text for the download manager appears in the top left and the download does not start either, please temporarily deactivate your ad blocker and reload the page.

50 programs

Put the system through its paces

WMIC for programmers

The following is an example of a tip for programming with WMIC. In order to determine the wear and tear of the notebook battery, for example, the CMD / Batch command powercfg -energy -output c: energy report.html Save an energy efficiency diagnostic report – in the example at the top on partition C. The HTML file lists the wear-relevant values ​​under “Intended battery capacity” (A) and “Last full charge” (B). A calculation is used to put the two in relation to determine the degree of battery wear and health: For example, A is “44250” milliampere hours (mhA) and B is “37290” mhA. If you want to know health, divide A by 100 (44250/100 = 442.5) and divide B divided by 442.5. The result is 84.2 percent – that’s how fit the battery is. Conversely, it is around 15 percent worn out. The basic arithmetic operations can be applied quite easily via batch. It is more difficult to get the two mhA values ​​out of the HTML report file (parse): That would be necessary in order to define them as variables and to calculate them. WMIC represents a solution here: It determines the two wear-relevant values ​​directly – without the intermediate path of an HTML file. You define these as variable values, calculate with them, link the calculation result with a variable and show it to the users via echo on. With the Windows Script Host, coders can display a graphical pop-up window as an alternative or in addition, which outputs any variable content. A batch WMIC code looks like this (to be saved as a BAT or CMD file): for / f “tokens = * delims =” %% a in (‘powershell -Executionpolicy Bypass -Command “(Get-WmiObject -Class” BatteryStaticData “-Namespace” ROOT WMI “). DesignedCapacity”‘) do set “akku1 = %% a “ for / f “tokens = * delims =” %% a in (‘powershell -Executionpolicy Bypass -Command “(Get-WmiObject -Class” BatteryFullChargedCapacity “-Namespace” ROOT WMI “). FullChargedCapacity”‘) do set “akku2 = %% a “ echo FULLY charged and FACTORY NEW, your notebook battery holds :::% akku1% mhA echo FULLY charged and CURRENTLY, your notebook battery holds :::% akku2% mhA To illustrate, we have above @echo off (at the beginning) and Break (at the end) omitted – if that tells you something, you might want to include both in your own scripts. The first block above defines the “intended battery capacity” as the content / value of the variable akku1 (any name), the second block does the same for the “last full charge” (variable name: akku2). The third and fourth lines show users the values ​​determined by echo with internal specification of the variable names. Technically inexperienced people simply double-click on such a batch file (in BAT or CMD format) and see the wear values ​​shown one below the other.
If you don’t want to set any variables, start the command line and execute the WMIC commands like this. Then the code constructs for defining the variables are omitted and the code is leaner – the first code part allows PowerShell code to be executed: powershell -Executionpolicy Bypass -Command “(Get-WmiObject -Class” BatteryStaticData “-Namespace” ROOT WMI “). DesignedCapacity” powershell -Executionpolicy Bypass -Command “(Get-WmiObject -Class” BatteryFullChargedCapacity “-Namespace” ROOT WMI “). FullChargedCapacity”
[ad_2]

Share:

Facebook
Twitter
Pinterest
LinkedIn

Leave a Reply

Related Posts

Can You Snort Marijuana

Can You Snort Marijuana Simply put, snorting marijuana is not a smart or safe way to use it. Most people smoke, vape, or eat edibles

Can Marijuana Cause Diarrhea

Can Marijuana Cause Diarrhea Simply put, using marijuana can sometimes cause stomach problems like diarrhea, but it’s not completely clear if one directly causes the

Drying Marijuana in Paper Bags

Drying Marijuana in Paper Bags Key Takeaways Discover why using paper bags is advantageous for drying marijuana Learn essential steps and expert techniques for efficiently

Can You Vacuum Seal Marijuana

Can You Vacuum Seal Marijuana You can totally vacuum seal your weed, no problem. Vacuum sealing helps keep your stash fresh and potent by getting