Searle
Searle

Reputation: 987

CMD: How do I recursively remove the "Hidden"-Attribute of files and directories

I can't find a command or simple batch of commands to recursively remove the "Hidden"-Attribute from files and directories. All commands like "attrib" and "for" seem to skip hidden files. E.g.:

attrib -H /S /D /L mydir

doesn't do anything at all, because it skips all hidden stuff. Does someone know how to do this with standard Windows tools?

Upvotes: 22

Views: 188065

Answers (7)

Kaycii
Kaycii

Reputation: 59

To launch command prompt in administrator mode

  1. Type cmd in Search and hold Crtl+Shift to open in administrator mode
  2. Type attrib -h -r -s /s /d "location of the drive letter:" \*.*

Upvotes: 4

barter
barter

Reputation: 11

For example folder named new under E: drive

type the command:

e:\cd new

e:\new\attrib *.* -s -h /s /d

and all the files and folders are un-hidden

Upvotes: 1

Zubair
Zubair

Reputation: 389

if you wanna remove attributes for all files in all folders on whole flash drive do this:

attrib -r -s -h /S /D

this command will remove attrubutes for all files folders and subfolders:

-read only -system file -is hidden -Processes matching files and all subfolders. -Processes folders as well

Upvotes: 7

mburakkalkan
mburakkalkan

Reputation: 1178

To make a batch file for its current directory and sub directories:

cd %~dp0
attrib -h -r -s /s /d /l *.*

Upvotes: 1

user2400629
user2400629

Reputation: 1

just type

attrib -h -r -s /s /d j:*.*

where j is the drive letter... unlocks all the locked stuff in j drive

if u want to make it specific..then go to a specific location using cmd and then type

attrib -h -r -s /s /d "foldername"

it can also be used to lock drives or folders just alter "-" with "+"

attrib +h +r +s /s /d "foldername"

Upvotes: 0

Doormatt
Doormatt

Reputation: 541

You can't remove hidden without also removing system.

You want:

cd mydir
attrib -H -S /D /S

That will remove the hidden and system attributes from all the files/folders inside of your current directory.

Upvotes: 42

James K
James K

Reputation: 4055

Move the -h and specify that mydir is a directory

attrib /S /D /L -H mydir\*.*

Upvotes: 13

Related Questions