Posted by DJ on August 26, 2016 at 11:43:48:
In Reply to: tech - Batch file to execute when directory closed posted by Joe Monroe on August 25, 2016 at 19:46:08:
: Hi, What I have done is to place a batch file in a folder that when executed unhides a previously hidden sub-folder, using the command: attrib "foldername" -s -h
: This makes navigation within the previously hidden sub-folder much easier than another method I saw online that just "starts" the sub-folder in a new window.
: I would like to either add a snippet of code to the existing batch file that would wait until the sub-folder is exited and then re-hide it (using attrib "foldername" +s +h), or to create a second batch file that would be triggered by the sub-folder exit and then hide it (without having to manually execute it).
: Is that possible?
You should be able to do it by using the SET command and then creating an IF test. Something like this:
Set /P x=Hide it (Y/N)?
if /I {%x%}=={y} (goto :yes)
if /I {%x%}=={n} (goto :no)
:yes
attrib +h Foldername
:no
attrib -h Foldername