Celeb Glow
general | March 01, 2026

Windows Command to get all information/properties of a file

Is there any command get all the properties of a file including its encoding format (this piece of information is really important to me) on Windows ? I'm looking for something similar to stat in Linux

I'd prefer using a command that can be used in command-prompt or a batch script although I know its possible with Powershell.

2

3 Answers

You can use WMIC feature to do that.

For example :

F:>> wmic datafile where Name="anyfile.txt"

to get all information about anyfile.txt. You can use CMD and powershell too to using WMIC. And you can use GET parameter to get a specified information.

For Example:

F:>> wmic datafile where Name="F:\\ekojs.txt" get Description,Path,Status,Version

EDIT :Try using this before to check the WMIC functionality :

F:>> wmic datafile /?

To get a help how to using it.

Command :

wmic datafile where Name="F:\\ekojs.txt" get Description,Name,FileType >> eko_wmic.txt

Output in eko_wmic.txt:

Description FileType Name
f:\ekojs.txt Text Document f:\ekojs.txt 

Hope this'll help you out..

14

To build on the previous answer. You can use wmic datafile to get info about a file, but you have to provide the full path and double-up your slashes like so

wmic datafile where Name="F:\\anyfile.txt"

This gives an unreadable mess in the console, as you'll see:

what a great way to render data, wmic

However if you pipe this into a text file, it's pretty legible

wmic datafile where Name="F:\\anyfile.txt" >> fileprops.txt

enter image description here

Fortunately, wmic can format the info as a list, and then it is actually pretty useful.

wmic datafile where Name="F:\\anyfile.txt" list /format:list

enter image description here

You can then provide these properties only for a simplified view, note that you must remove the list keyword.

>wmic datafile where Name="G:\\ipcamera.log" get Hidden,FileSize,Name /format:list
FileSize=20
Hidden=FALSE
Name=G:\ipcamera.log

A little piece of trivia, wmic was the foundation for what eventually became PowerShell!

1

You can use any scripting language that can use COM objects such as vbscript and powershell to access a files extended properties (Title, Duration, Frame rate, etc.) using the Shell.Application object. Unfortunately, cmd does not have a direct way to access the Shell object, you will have to piggyback on some other scripting language to access the Shell object.

Running the following command from a cmd prompt window will display the duration of the video file in 100ns units (not milliseconds).

PowerShell -Command "$FilePath='C:\Videos\Test.mp4'; Write-Host ((New-Object -COMObject Shell.Application).NameSpace((Split-Path -Parent -Path $FilePath))).ParseName((Split-Path -Leaf -Path $FilePath)).ExtendedProperty('System.Media.Duration')"

Additional information about the command can be found at Enumerate file properties in PowerShell