Unhide, Unlock, Unleash: Using the attrib Command in Windows

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

cmd
attrib [options] [pathname]

You can add or remove attributes using:

  • + to set an attribute
  • - to remove it

Common Attributes

SwitchMeaning
RRead-only
HHidden
SSystem file
AArchive (used for backup tracking)

Examples You Can Actually Use

1. View a file’s attributes

cmd
attrib myfile.txt

Output might look like:

cmd
A  R  C:\Users\Zaur\Documents\myfile.txt

✅ “A” = archive
✅ “R” = read-only

2. Remove the read-only attribute

cmd
attrib -R important.txt

This is a common fix when a file refuses to be edited or deleted.

3. Make a file read-only

cmd
attrib +R important.txt

Now you (and your scripts) can’t accidentally overwrite it.

4. Hide a folder

cmd
attrib +H "C:\SecretFolder"

5. Unhide a folder

cmd
attrib -H "C:\SecretFolder"

Boom — it appears in File Explorer again.

6. Make a file hidden and read-only

cmd
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)

cmd
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 AppData or ProgramData)
  • 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

  • attrib only 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:

TaskCommand
View attributesattrib file.txt
Make read-onlyattrib +R file.txt
Remove hidden/system flagattrib -H -S file.txt
Change all files in a folderattrib -R -H /S /D C:\Path\*.*
Hide a folderattrib +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.

Leave a Comment