"No Instance(s) Available" error with the wmic command
I'm getting a "No Instance(s) Available" error with the wmic command. The command I'm running (from an elevated/administrator cmd.exe window) is:
G:\>wmic datafile where name="file.txt" get creationdate
No Instance(s) Available
The file "file.txt" does exist.
I have found some mention of this problem in other SU questions/answers like the answer here:
Windows Command to get all information/properties of a file
but I have not found any mention of how to fix (or even troubleshoot) this problem.
I'm running Windows 7 Home Premium x64.
When I run "wmic datafile /?" I get usage syntax help:
G:\>wmic datafile /?
DATAFILE - DataFile Management.
HINT: BNF for Alias usage.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>].
USAGE:
DATAFILE ASSOC [<format specifier>]
DATAFILE CALL <method name> [<actual param list>]
DATAFILE CREATE <assign list>
DATAFILE DELETE
DATAFILE GET [<property list>] [<get switches>]
DATAFILE LIST [<list format>] [<list switches>]
I'm getting a "No Instance(s) Available" error with the following wmic command.
G:\>wmic datafile where name="file.txt" get creationdate
You need to provide the full name (including the drive and path) of the file.
Example:
F:\test>wmic datafile where name="C:\\Windows\\system32\\notepad.exe" get CreationDate
CreationDate
20090714005636.838522+060
Note the use of \\
to escape a single \
in the above example name string.
If you wish to include the following special characters in your string, you must first escape the character by prefixing the character with a backslash (\):
- backslash (\\)
- double quotes (\")
- single quotes (\')
Source WHERE Clause
What are the valid keywords (name, path, ...) for the where clause with datafile?
You can get the property list from the command line using:
wmic datafile get /?
Any of the property names can be used in a where clause.
F:\test>wmic datafile get /?
Property get operations.
USAGE:
GET [<property list>] [<get switches>]
NOTE: <property list> ::= <property name> | <property name>, <property list>
The following properties are available:
Property Type Operation
======== ==== =========
Access Rights N/A N/A
Caption N/A N/A
Class Name N/A N/A
Compressed N/A N/A
Compression Method N/A N/A
Computer System Class Name N/A N/A
Computer System Name N/A N/A
Creation Date N/A N/A
Current File Open Count N/A N/A
Description N/A N/A
Drive N/A N/A
Eight Dot Three File Name N/A N/A
Encrypted N/A N/A
Encryption Method N/A N/A
File Extension N/A N/A
File Name N/A N/A
File System Class Name N/A N/A
File System Name N/A N/A
File Type N/A N/A
Hidden N/A N/A
Install Date N/A N/A
Last Accessed N/A N/A
Last Modified N/A N/A
Manufacturer N/A N/A
Name N/A N/A
Path N/A N/A
Readable N/A N/A
Should Be Archived N/A N/A
Size N/A N/A
Status N/A N/A
System File N/A N/A
Version N/A N/A
Writeable N/A N/A
Further Reading
WMIC Best practices
WHERE Clause