1
I am trying to hide everything in a certain folder (with the exception of one file in the folder) without hiding the folder itself. This is what I have so far.
@ECHO OFF
cls
title Hide everything but useful shortcuts and program files
attrib +h "%CD:~0,3%Fix It Files" /S /D
attrib -h "%CD:~0,3%Fix It Files\Program Files" /S /D
attrib -h "%CD:~0,3%Fix It Files\%CD:~0,1% Shortcuts" /S /D
attrib -h "%CD:~0,3%Fix It Files"
exit
What we are looking at here is that I am trying to hide the folder called "Fix It Files" and everything in it in whatever drive the batch file is in. Then I unhide a two folders that I would rather stay unhidden; one I want to always be unhidden, the other depends on which drive it is in. Then I unhide the parent folder "Fix It Files".
At least, that is my goal. The issue is, while it hides and later unhides the folder "Fix It Files", all of the files inside stay unhidden.
1Why don't you change your first attrib to
attrib +h "%CD:~0,3%Fix It Files\*" /S /D
andomit the last one? – LotPings – 2017-07-05T19:09:43.637That works. Perhaps you make that into an answer so I can accept that – A Child of God – 2017-07-05T20:50:19.300