Clear Stubborn File Attributes with attrib
Remove hidden, system and read-only flags from files or whole directory trees.
01Command
$ attrib -h -s -r "D:\USB\file.txt"02What it does
attrib is the classic way to fix files copied off USB drives that Windows marks hidden and undeletable: -h -s -r removes all three flags in one line. Adding /S processes matching files in subdirectories and /D also processes the folders themselves. The command's syntax is easy to forget because the minus signs belong directly in front of each letter with no spaces.
03Risk
04Undo
$ attrib +h +s +r "D:\USB\file.txt"05Sources
- attrib - Windows CommandsEvidence: Documents attrib's attribute switches (+R -R, +H -H, +S -S) and the /S /D switches for recursive directory handling.
Last verified: 2026-09-17 · Category: Files & Folders
06Related solutions
One command that shows OS version, install date, boot time, memory, network adapters and installed hotfixes.
Built-in Windows command to compute MD5, SHA1 or SHA-256 hashes of any file.
Save a cleanup profile once, then run it unattended on any schedule.