Use this when files are hidden, read-only or behave oddly because of attributes.
File Attributes
File attributes are flags such as Read-only, Hidden, System, Archive, Compressed and Encrypted. View and change them with attrib or Get-Item | Select Attributes.
1. Get-Item <file> | Select Attributes.
2. attrib <file> — R, H, S, A.
3. Read-only blocking writes → attrib -r.
4. Hidden/system → Get-ChildItem -Force.
5. Archive bit used by some backups.
file attributes stored with the file → honoured by tools
Context & applicabilityCommon mistakes · platform/version boundaries
- Malware hiding files with
+h +s, so they are invisible in Explorer. - Read-only attribute mistaken for permissions (it does not stop admins).
- Archive bit used by old backup tools while modern tools use change journals.
Operational reference
Fast context before you go deeper.
Get-Item file.txt | Select-Object AttributesEvidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Read-only prevents edits until cleared.
- Hidden plus System hides files even with hidden items shown.
- Some backup tools use the Archive bit.
Get-Volume— volumes, filesystem type, health and free spacefsutil fsinfo volumeinfo C:— filesystem featureschkdsk C: /scan— online scanGet-WinEvent -FilterHashtable @{LogName='System';ProviderName='Ntfs'} -MaxEvents 20— NTFS events
ReferenceHow it works1 section · depth on demand
In depth
File attributes control behaviour beyond permissions:
| Attribute | Flag | Effect |
|---|---|---|
| Read-only | R | Prevents writes (folders: ignored by Explorer for customisation) |
| Hidden | H | Hidden in normal listings |
| System | S | OS file, hidden with "protected OS files" |
| Archive | A | Changed since last backup |
| Compressed / Encrypted | C / E | NTFS compression / EFS |
| Offline / Recall on open | O / M | Files On-Demand (OneDrive), HSM |
| Not content indexed | I | Excluded from search index |
attrib +h +s C:\Data\secret.txt
Get-Item C:\Data\file.txt | Select Attributes
ReferenceImportant terms & boundaries1 section · depth on demand
Attribute flags
| Flag | Meaning |
|---|---|
| R | Read-only |
| H | Hidden |
| S | System |
| A | Archive (changed since backup) |
| I | Not content indexed |
| P / U | Pinned / unpinned (OneDrive Files On-Demand) |
| O | Offline |
attrib +h +s file hides a file from normal listings; dir /a shows it.
ReferenceConfiguration & state1 section · depth on demand
Commands
attrib file.txt # show attributes
attrib +h +r file.txt # set Hidden and Read-only
Get-Item file.txt | Select-Object Attributes
(Get-Item file.txt).Attributes += 'Hidden'
| Attribute | Meaning |
|---|---|
| R | Read-only (on folders it is mostly ignored by Explorer) |
| H | Hidden |
| S | System file |
| A | Archive: changed since last backup |
| C / E | NTFS compressed / EFS encrypted |
Hidden files are still visible with dir /a or Get-ChildItem -Force.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Filesystem → File Attributes. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/windows-server/storage/file-server/ntfs-overview · confidence 94%