How can I check basic file details from the command line?
Quick answer
In PowerShell, use Get-ChildItem -Path '.\practice.txt' | Select-Object Name, Length, Extension, CreationTime, LastWriteTime, Attributes to display common details for one file. Replace the example path with your file’s path. These are properties PowerShell makes available; an extension is part of the filename, not proof of the file’s contents. Timestamp meanings and available details can vary by filesystem or provider. [S1] [S2]
The question, the details, the next step.
A practical checklist
Confirm your terminal is PowerShell before using these examples.
Replace the sample filename or folder path with the practice item’s actual path.
Use
Get-ChildItemwith a file path for one file or a folder path to list its contents.Read
Lengthas the reported file size andExtensionas part of the filename, not proof of file contents.Treat available fields and timestamps as dependent on the filesystem or provider.
A few more useful answers
Does `Get-ChildItem` show the size of a folder?
It can list filesystem items, but a directory and a file do not necessarily have the same useful size interpretation. Don’t read a folder’s displayed size as though it were a file’s length. [S1]
Can the extension tell me exactly what kind of file it is?
No. The extension is a property of the filename; this command displays it but does not inspect or verify the file’s contents.
Can these commands tell me exactly when a file was created on every system?
They can display a CreationTime property when available, but timestamp availability and meaning are not established as identical across every filesystem or provider. [S2]
Sources
References used for this guide.
- [S1] PowerShell Get-ChildItem: listing names, sizes, timestamps, and attributes learn.microsoft.com · Checked
- [S2] PowerShell FileInfo properties for inspecting file details learn.microsoft.com · Checked
