Ever had a file mysteriously vanish? Or a folder that just refuses to be deleted?
Chances are, it has attributes that are messing with you — and Windows won’t always say why. That’s where the attrib command comes in.
This old-school utility lets you view and change file/folder attributes directly from the command line — no right-clicking required.
Let’s jump into what it is, how it works, and how to use it to make hidden or locked-down files behave.
What Is attrib?
attrib is a command-line tool that lets you:
- View file/folder attributes (hidden, read-only, system, etc.)
- Add or remove those attributes
It’s a fast way to take control of files when Explorer says “Nope” but doesn’t tell you why.
Basic Syntax
attrib [options] [pathname]
You can add or remove attributes using:
+to set an attribute-to remove it
Common Attributes
| Switch | Meaning |
|---|---|
R | Read-only |
H | Hidden |
S | System file |
A | Archive (used for backup tracking) |
Examples You Can Actually Use
1. View a file’s attributes
attrib myfile.txt
Output might look like:
A R C:\Users\Zaur\Documents\myfile.txt✅ “A” = archive
✅ “R” = read-only
2. Remove the read-only attribute
attrib -R important.txt
This is a common fix when a file refuses to be edited or deleted.
3. Make a file read-only
attrib +R important.txt
Now you (and your scripts) can’t accidentally overwrite it.
4. Hide a folder
attrib +H "C:\SecretFolder"
5. Unhide a folder
attrib -H "C:\SecretFolder"
Boom — it appears in File Explorer again.
6. Make a file hidden and read-only
attrib +H +R "C:\HiddenReadOnly.txt"
Great for prank files or files you want to protect.
7. Change attributes for all files in a folder (recursively)
attrib -H -S /S /D "C:\SomeFolder\*.*"
Explanation:
/S= apply to subfolders/D= include directories themselves
⚠️ Use with care — this can affect a lot of files quickly.
Common Use Cases
- Unhiding system folders (like
AppDataorProgramData) - Fixing “access denied” or “file in use” errors
- Cleaning up malware leftovers that hide files
- Making backup-friendly files (clearing archive flags)
⚠️ Things to Know
attribonly works on NTFS or FAT file systems (which is 99% of Windows)- It doesn’t show ownership or permissions — just attributes
- You must use quotes if paths contain spaces
- Some operations may require admin rights (especially with system files)
In a nutshell:
| Task | Command |
|---|---|
| View attributes | attrib file.txt |
| Make read-only | attrib +R file.txt |
| Remove hidden/system flag | attrib -H -S file.txt |
| Change all files in a folder | attrib -R -H /S /D C:\Path\*.* |
| Hide a folder | attrib +H C:\MyFolder |
Final Thoughts
The attrib command might not be flashy, but it’s incredibly useful when Windows Explorer gives you zero feedback. Whether you’re un-hiding lost folders, protecting important files, or just playing tricks on your coworkers (ethically, of course 😄), attrib is the quick tool to have in your toolkit.
Stay tuned — we’ll dive into more stealthy file control tricks in future posts. Maybe even some PowerShell wizardry to bulk-reset attributes across directories like a true CLI ninja.