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>]
Best Answer
I'm getting a "No Instance(s) Available" error with the following wmic command.
You need to provide the full name (including the drive and path) of the file.
Example:
Note the use of
\\
to escape a single\
in the above example name string.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:
Any of the property names can be used in a where clause.
Further Reading
WMIC Best practices
WHERE Clause