Question

I want to create a small .bat file that will hide all items in one specific folder (actually add attributes +s and +h to them), but I am not really good at scripting so I need your help.

Thanks in advance.

edit: I don't want folder to be hidden, but just all items inside it.

Was it helpful?

Solution 2

This should do the job and hides folders also.

attrib +s +h "c:\folder\*.*" /D

OTHER TIPS

use dir /A /D, the result gives all directory names enclosed in [] and file name without []. Loop through all the names which are not enclosed within [] and set the attribute using attrib +s +h

for /f "delims=" %%a in ('dir /a /b "c:\somewhere\*"') do attrib +h +s "%%~fa"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top