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.

有帮助吗?

解决方案 2

This should do the job and hides folders also.

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

其他提示

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"
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top