China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-31 21:17
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] How to use WMIC to find a specified file? View 4,089 Replies 14
Original Poster Posted 2006-12-10 13:33 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline

  Since I am learning how to use WMIC and don't know many of its usages, I am now separately posting a help request. Please help me.

  May I ask, how to use WMIC to find a specified file? For example, I want to find the lxmxn.vbs file in the lxmxn\cn-dos directory on drive F. What is the WMIC command? If I want to save the search result to an html file, how is the format written?
Floor 2 Posted 2006-12-10 14:49 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
```
wmic datafile where "name='f:\\lxmxn\cn-dos\\lxmxn.vbs'" list
```
Floor 3 Posted 2006-12-10 15:19 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Originally posted by 3742668 at 2006-12-10 14:49:

wmic datafile where "name='f:\\lxmxn\\cn-dos\\lxmxn.vbs'" list


  The moderator here, the "f:\\lxmxn\cn-dos\\lxmxn.vbs" has one less "\", it should be "\\\" to find it.
Floor 4 Posted 2006-12-11 05:47 ·  中国 河南 郑州 电信
中级用户
★★
Credits 439
Posts 170
Joined 2006-01-09 20:29
20-year member
UID 48707
Status Offline
Where can I find a tutorial on WMIC? Please provide one. I also want to learn it.
bat c c++
Floor 5 Posted 2006-12-11 06:41 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline

  The tutorial I used is:
hh wmic.chm
Floor 6 Posted 2006-12-11 06:44 ·  中国 河南 郑州 电信
中级用户
★★
Credits 439
Posts 170
Joined 2006-01-09 20:29
20-year member
UID 48707
Status Offline
Swe sweat, this page cannot be displayed, really dizzy

Cannot open file wmic.chm
bat c c++
Floor 7 Posted 2006-12-11 07:00 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
Just using `wmic /?` is sufficient.

Didn't see the requirements for the topic clearly. Regarding outputting in web page format:

@echo off

rem File name processing:
set "file=d:\a.html"
set "file=%file:\=\\%"

rem Output redirection
set "outFile=out.html"
rem If you want to save the result to the clipboard, set outfile to the following value
rem set "outFile=CLIPBOARD"

rem Output format:
set "fileType=htable"

wmic /output:%outFile% datafile where "name='%file%'" list /format:%fileType%
exit /b 0
Floor 8 Posted 2006-12-11 07:08 ·  中国 北京 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
Wonderful!!!
The moderator can be called a generation of batch processing masters~~~

(Note: Batch - represents batch processing~: D)
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 9 Posted 2006-12-11 08:12 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline

  Thanks moderator. There is still a question, how exactly is the format defined after format? What are other formats similar to htable? I can't find relevant information in the help.
Floor 10 Posted 2006-12-11 08:27 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
Originally posted by lxmxn at 2006-12-11 08:12:

  Thank you, moderator. There is another question. How exactly is the format defined after format? What are the other formats similar to htable? I can't find relevant details in the help.

Old comrade, you should take a good look at wmic /?.
CSV
HFORM
HMOF
HTABLE
HXML
LIST
TABLE
VALUE
htable-sortby
htable-sortby.xsl
texttablewsys
texttablewsys.xsl
wmiclimofformat
wmiclimofformat.xsl
wmiclitableformat
wmiclitableformat.xsl
wmiclitableformatnosys
wmiclitableformatnosys.xsl
wmiclivalueformat
wmiclivalueformat.xsl
Floor 11 Posted 2006-12-11 14:15 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline

When listing all process information with `WMIC PROCESS LIST FULL`, it is sorted by processid by default. Can it be sorted by name?
Floor 12 Posted 2006-12-29 07:47 ·  中国 浙江 湖州 电信
初级用户
Credits 73
Posts 30
Joined 2006-09-18 08:35
19-year member
UID 62944
Status Offline
You can issue the command like this, and after tidying up the generated text file, it will be ready:
H:\>wmic process get name >tmp.txt && sort < tmp.txt >out.txt
--------Mo Bo, on 2006-12-27
Floor 13 Posted 2006-12-29 07:52 ·  中国 浙江 湖州 电信
初级用户
Credits 73
Posts 30
Joined 2006-09-18 08:35
19-year member
UID 62944
Status Offline
::WMIC DATAFILE WHERE "Drive='C:' AND Extension='vbs'" GET Caption,CSName > DATAFILE.txt
WMIC DESKTOP WHERE "Name='new'" GET Name,ScreenSaverExecutable,ScreenSaverSecure,ScreenSaverTimeout,Wallpaper > DESKTOP.txt
WMIC DISKQUOTA WHERE "Limit >'10000'" > DISKQUOTA.txt
::WMIC FSDIR WHERE "Path='\\Windows\\'" GET CSName,Compressed,EightDotThreeFileName,Encrypted,Hidden,Writeable > FSDIR.txt
WMIC GROUP WHERE "Name='daode'" > GROUP.txt
WMIC JOB GET Command,RunRepeatedly,StartTime > JOB.txt
WMIC LOADORDER GET Name,GroupOrder /format:csv > LOADORDER.txt
::WMIC LOGICALDISK WHERE "DriveType='3' OR DriveType='4'" GET Caption,FreeSpace,ProviderName,Size,SystemName,FileSystem > LOGICALDISK.txt
WMIC MemLogical GET /FORMAT:CSV > MemLogical.txt
WMIC NETUSE GET Name,Status,UserName > NETUSE.txt
--WMIC PAGEFILESET WHERE "Name= 'C:\\pagefile.sys' SET InitialSize='500',MaximumSize='600'"
WMIC PRINTJOB GET Document,Name,Owner,PagesPrinted,Status,TimeSubmitted,TotalPages,Size,JobStatus,JobId > PRINTJOB.txt
::WMIC PROCESS WHERE "WorkingSetSize>'1000000'" GET Caption,CSName,ExecutablePath,ParentProcessId,ProcessId,WorkingSetSize > PROCESS.txt
WMIC QUOTASETTING LIST > QUOTASETTING.txt
--WMIC RDACCOUNT GET AccountName,PermissionsAllowed,PermissionsDenied > RDACCOUNT.txt
--WMIC RDNIC GET NetworkAdapterName,TerminalName > RDNIC.txt
--WMIC RDPERMISSIONS LIST > RDPERMISSIONS.txt
::WMIC RDTOGGLE WHERE "AllowTSConnections='1'" CALL SetAllowTSConnections 0
WMIC SCSICONTROLLER GET DriverName,Manufacturer,Name,Status,Systemname > SCSICONTROLLER.txt
WMIC TAPEDRIVE GET Compression,Description,Name,Status > TAPEDRIVE.txt
WMIC TEMPERATURE GET CurrentReading,Description,MaxReadable,MinReadable,Resolution > TEMPERATURE.txt
WMIC UPS GET FirstMessageDelay,LowBatterySignal,MessageInterval,RemainingCapacityStatus,UPSPort > UPS.txt
WMIC USERACCOUNT WHERE "Name='daode' AND Domain= " > USERACCOUNT.txt
--WMIC VOLTAGE GET Accuracy,CurrentReading,Description,MaxReadable,Resolution > VOLTAGE.txt
WMIC VOLUMEQUOTASETTING LIST > VOLUMEQUOTASETTING.txt
---------------------Collected, organized, adapted: Mobro MOBO, on 2006-12-27
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
lxmxn +6 2006-12-29 13:33
tj051181 +1 2010-06-05 00:17
Floor 14 Posted 2007-03-01 00:10 ·  中国 安徽 马鞍山 电信
中级用户
★★
Credits 493
Posts 228
Joined 2007-02-16 00:38
19-year member
UID 79596
Gender Male
From 安徽
Status Offline
E:\>WMIC USERACCOUNT WHERE "Name='administrator' AND Domain= " > USERACCOUNT.txt

Node - MS080514
Error:
Code = 0x80041017
Description = Invalid query
Device = WMI



E:\>WMIC USERACCOUNT WHERE(Name="administrator") >USERACCOUNT.txt

E:\>type USERACCOUNT.txt
AccountType Caption Description Disabled Domain
FullName InstallDate LocalAccount Lockout Name PasswordChangeab
le PasswordExpires PasswordRequired SID
SIDType Status
512 MS180418\administrator Built-in account for adminis
tering the computer/domain FALSE MS080514 TRUE FALSE administrator TRUE
FALSE TRUE S-1-5-21-1185841169-742266776-3604767735-
500 1 OK

[ Last edited by xycoordinate on 2007-2-28 at 11:22 AM ]
Floor 15 Posted 2008-02-23 10:41 ·  中国 山东 烟台 联通
中级用户
★★
Credits 257
Posts 123
Joined 2008-01-05 11:08
18-year member
UID 107722
Gender Male
From 烟台
Status Offline
Support me
My operating system is not in Chinese
Have pity on me
路 是自己选的
学习 是为了具备解决问题的能力
Forum Jump: