Could anyone tell me what this command says? I used this command when I couldn't find my files on my flash drive. but I don't know what it is saying, I only know -h and -r which remove the hidden and read-only attribute, respectively.
attrib -h -r -s /s /d g:\*.*
2 Answers
DavidPostill's answer lists the meanings of all attrib's switches. Let's use that to interpret that specific command:
-hremoves the hidden attribute (so the items will show up in Explorer)-rremoves the read-only attribute-sremoves the system attribute (also so the items will show up in Explorer)/smakes the command look in all subfolders recursively/dmakes it apply the attributes to folders too (not just files)g:\*.*is the path to apply the changes on
So, I conclude that the command was meant to unset all attributes from everything on the G drive (*.* means all files with an extension; * is a wildcard that matches one or more characters. The /s makes it do everything in all folders under your starting directory, g:\.)
If you're trying to find a file, that command might make stuff show up in Explorer (assuming you're not showing hidden/system files anyway), but it won't magically tell you the location of whatever you're looking for. To find a specific file, try Explorer's search feature.
What does this command mean?
attrib -h -r -s /s /d g:\*.*
Run attrib /? to get help:
F:\test>attrib /?
Displays or changes file attributes.
ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [+I | -I]
[drive:][path][filename] [/S [/D] [/L]]
+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
I Not content indexed file attribute.
[drive:][path][filename]
Specifies a file or files for attrib to process.
/S Processes matching files in the current folder
and all subfolders.
/D Processes folders as well.
/L Work on the attributes of the Symbolic Link versus
the target of the Symbolic Link
Notes:
- attrib goes into a lot more detail about the
attribcommand.
Further Reading
- An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
- attrib - Display or change file attributes.