Output the list full of all WMIC values and use keywords to search results.

Source: Internet
Author: User

During this time, WMIC is used to query a lot of related information on win.

But sometimes I want to find a piece of information. I don't know which alias to go to WMIC to search,
However, using list full based on relevant aliases makes it too difficult to search for information.

Therefore, I think that you can first list all aliases and redirect the output to the corresponding text file.
Then, you can search for all text files output by keyword. The text file contains all the fields and output information of the alias.

It is decided to use C to output all alias list full functions, and all aliases must be written

"Alias_1 ",
"Alias_2 ",
...
"Alias_n ",
Null

In the format of "WMIC /? "Output to copy is undoubtedly very troublesome.

The following are the processing methods:

1) Run "WMIC /? | Find "-"> "E: \ temp \ Temp"
2) Delete the first and second rows of non-alias information in temp.
3) use Notepad ++ to open temp and find many blank lines. Select "View"-"display symbol"-"Show All characters", as shown below:
Alias_1-description \ r
\ R \ n
Alias_2...
...
Open the "replace" dialog box and select "extension" in "search mode ". Replace all \ r \ n with null and empty rows to remove them.
4) Select the lookup mode to "Regular Expression", replace [^ A-Z]. * $ with ", replace ^ with", then the temp file displays the following
"Alias_1 ",
"Alias_2 ",

...

Then, Run "WMIC alias_n list full> E: \ temp \ wmic_list_full \ alias_n.txt" based on the alias array. The following is the implementation of the Program:

/* * author: xiaomu * date: 2012/03/20 */#include <stdio.h>#include <string.h>#include <stdlib.h>#define LEN 1024static char *menu[] = {"BASEBOARD","BIOS","BOOTCONFIG","CDROM","COMPUTERSYSTEM","CPU","CSPRODUCT","DATAFILE","DCOMAPP","DESKTOP","DESKTOPMONITOR","DEVICEMEMORYADDRESS","DISKDRIVE","DISKQUOTA","DMACHANNEL","ENVIRONMENT","FSDIR","GROUP","IDECONTROLLER","IRQ","JOB","LOADORDER","LOGICALDISK","LOGON","MEMCACHE","MEMLOGICAL","MEMPHYSICAL","NETCLIENT","NETLOGIN","NETPROTOCOL","NETUSE","NIC","NICCONFIG","NTDOMAIN","NTEVENT","NTEVENTLOG","ONBOARDDEVICE","OS","PAGEFILE","PAGEFILESET","PARTITION","PORT","PORTCONNECTOR","PRINTER","PRINTERCONFIG","PRINTJOB","PROCESS","PRODUCT","QFE","QUOTASETTING","RECOVEROS","REGISTRY","SCSICONTROLLER","SERVER","SERVICE","SHARE","SOFTWAREELEMENT","SOFTWAREFEATURE","SOUNDDEV","STARTUP","SYSACCOUNT","SYSDRIVER","SYSTEMENCLOSURE","SYSTEMSLOT","TAPEDRIVE","TEMPERATURE","TIMEZONE","UPS","USERACCOUNT","VOLTAGE","VOLUMEQUOTASETTING","WMISET",NULL};int wmic_list_full();int main(){wmic_list_full();return 0;}int wmic_list_full(){char **ptr;char buf[LEN];ptr = menu;while( *ptr != NULL){memset(buf, 0, LEN);sprintf(buf, "wmic %s list full > e:\\temp\\wmic_list_full\\%s.txt", *ptr, *ptr);printf("%s --- done\n", buf);*ptr ++;system(buf);}return 0;}int wmic_get_help(){char **ptr;char buf[LEN];ptr = menu;while( *ptr != NULL){memset(buf, 0, LEN);sprintf(buf, "wmic %s get /?> e:\\temp\\wmic_get_help\\%s.txt", *ptr, *ptr);printf("%s --- done\n", buf);*ptr ++;system(buf);}return 0;}

Now, you can use the "file search" function of notepad ++ to search for keywords in all output files.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.