I'd like to write a .bat file that opens multiple folders if none of the aforementioned folders or files are open, and closes all of the multiple folders if any of them are open in Windows Explorer or being run by Windows.
I think I can solve the conditional problem with this method mentioned on the cmd.exe: complex conditions? post but I cannot get it to work for my needs for everything I've tried.
set COND=
if COND1 set COND=1
if COND2 set COND=1
if defined COND ...
I am not sure how I check for what folders are open in Windows Explorer but I found the close solution on the cmd: Open explorer window of folder if not already open post but I still cannot work out the correct logic to use after several tries.
Is there a simpler way to check for whether a folder is open, or a process is run?