I have a batch program that opens up programs and files in specific order so I can have everything open up without even a single click when I sign in to the computer. This script will run automatically for both cold boots and by adapting the answer it will be possible to run the script to simply open windows not already opened without creating duplicates.
This bit of code works perfectly for almost everything I need by determining if a program is already running or not:
SETLOCAL EnableExtensions
set EXE=notepad++.exe
FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto FOUND
start C:\MEDIA\OFFICE\Notepad++\notepad++.exe
goto FIN
:FOUND
echo Notepad++ is already running.
:FIN
However I am not sure how to use this method (or what alternative methods exist) that will tell me if the following specific shell folder is open or not.
The desired/working path (My Documents
) is:
start %windir%\explorer.exe shell:UsersFilesFolder\JAB Creations
The absolute path (My Computer
) is:
D:\My Documents\JAB Creations
Important Clarifications
- The directory is a symbolic link, that command if you are curious is
Mklink /J "C:\Users\John\JAB Creations" "D:\My Documents\JAB Creations"
. - I do not want to use the absolute path, I want the directory opened under
My Documents
, notMy Computer
. - I have removed the garbage entries in Windows Explorer such as
Libraries
andQuick Access
and I useMy Documents
(which is now calledUser Files
). This command opens the directory viaMy Documents
instead of having it listed underMy Computer
in example. - If you are testing you will need to enable
Expand to open folder
andShow all folders
options in theFolder Options
window under theView
tab otherwise useful directories are hidden by default.
Important Prerequisites
First fix the folder options otherwise an attempt is pointless:
Secondly this is what should visually occur: