79661524

Date: 2025-06-11 07:02:46
Score: 0.5
Natty:
Report link

the %cmdcmdline% approach winds up yielding the same 'shell execute' style path under the special context where a custom Windows filetype (cmd.exe ftype command) has been associated with an auto execute file extension (assoc + %PATHEXT%) (here's my own project demonstrating that kind setup, but it's not in scope to include all that code here)

what worked for us is a quickly built util "pids.exe" that provides the nested parent process names, and then using that to check for whether explorer.exe was present, for example:

for /f %%v in ('pids.exe -name -level 3') do if \"%%v\"==\"explorer.exe\" timeout /t 10

permalink to this usage in a demonstrable script

pids will dump a typical usage block when no args are provided and there are a few more flags that might come in handy in slightly different situations

i imagine there are other command line tools already out there doing this, i just couldn't find them with an admittedly light amount of searching

Reasons:
  • Contains signature (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Beej