• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Tracking specific Explorer shell folder / instance via "//" /title

Joined
May 13, 2015
Messages
285 (0.12/day)
Processor AMD Ryzen 3800X / AMD 8350
Motherboard ASRock X570 Phantom Gaming X / Gigabyte 990FXA-UD5 Revision 3.0
Cooling Stock / Corsair H100
Memory 32GB / 24GB
Video Card(s) AMD Radeon 290X (Toggling until 6950XT)
Storage C:\ 1TB SSD, D:\ RAID-1 1TB SSD, 2x4TB-RAID-1
Display(s) Samsung U32E850R
Case be quiet! Dark Base Pro 900 Black rev. 2 / Fractal Design
Power Supply EVGA Supernova 1300G2 / EVGA Supernova 850G+
Mouse Logitech M-U0007
Keyboard Logitech G110 / Logitech G110
I'm a web developer and use a few different independent tools and I've been working on a batch program that opens up windows in a particular order. A new "feature" I figured out was how to determine if a window was already open or not, fantastic! As a web developer / design my goal is to always program dynamically - call a function (or in this case, a batch program) and it will just work regardless of the context.

However there is one particular trouble child - Windows Explorer. Before I go further though I need to establish a few axioms:
  • This topic deals with the Windows Shell is and how commands to explorer.exe work.
  • When I refer to My Documents I am referring to what Microsoft now calls "User Files".
  • When I refer to Windows Explorer I am referring to what Microsoft now calls "File Explorer".
  • In order to view My Documents in Windows Explorer one must fix the two settings in the Folder Options as I've highlighted in the first image.
  • The Run command to open the My Documents folder is %windir%\explorer.exe shell:UsersFilesFolder.
  • I'm testing this using Windows 10 Pro x64.
In order to participate without being completely confused it's important to reveal all the folders in the navigation panel of Windows Explorer:

figure1.png


So this thread specifically deals with the goal of tracking a specific instance of Windows Explorer. For me that instance is tracking if a window opened with the command %windir%\explorer.exe shell:UsersFilesFolder\JAB Creations. That is my work directory.

Critical: I have always removed the garbage Microsoft dumps in to the navigation panel of Windows Explorer. It irritates me because it confuses the common user and it's supposed to be their computer, not a garbage dump of confusion. So to the point: the command I use opens up my work directory listed under My Documents - not My Computer. As illustrated in the second image:

figure2.png


I have come across a potential solution which I can vouch for in part though I'll follow up with the problem afterwards.

I've come across a parameter for Windows Explorer: "//" /title. You can track that instance of a window using tasklist /fi "imagename eq explorer.exe" /fo list /v.

The problem? How do I combine "//" /title and %windir%\explorer.exe shell:UsersFilesFolder\JAB Creations? I have obviously combined them putting one before the other, using quotes and various combinations of the two without success. Typically either another Command Prompt window opens or a Windows Explorer instance opens though not to my work directory.

I'm sure there is some technicality though I don't do any programming with Microsoft languages and have gotten this far through a bit of persistence and testing.

Here is an example of the code to determine if a window is open or not that I would like to combine a working answer with:

SETLOCAL EnableExtensions
set EXE=waterfox.exe
FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto FOUND
start C:\MEDIA\INTERNET\Waterfox\56.0\waterfox.exe -P "Waterfox 56.0"
goto FIN
:FOUND
echo Waterfox is already running.
:FIN


Anyone have any helpful suggestions or a working answer?
 
Top