Skip to content

Problems running multiple instances of batch files #28

@masterofobzene

Description

@masterofobzene

Hello Oleg

Here I am again after so much time with the problem with batch files not working as intended. This time I think I kind of figured out a pattern of failures and the root cause seems to be a race condition or something like that.

Let me explain this with an example because it would be difficult to me otherwise:

We made around 100 entries for the menu using shell-x. Yes a lot. No icons.
These entries are separated into folders:
C:\Users\someone\AppData\Roaming\shell-x\[gif,mp4,mov,mpg,mpeg,avi,mkv,webm,ts,wmv,m4v,flv]\02.MOVER A EXTERNO\HIGHLIGHTS\TODO then inside "TODO" folder, we have even more folders each with a batch file in it, e.x: .\TODO\A\A.c.ms.cmd , .\TODO\B\B.c.ms.cmd and so on until Z.

We also have special bat files that we put in a similar structure, say for example:
C:\Users\someone\AppData\Roaming\shell-x\[gif,mp4,mov,mpg,mpeg,avi,mkv,webm,ts,wmv,m4v,flv]\02.MOVER A EXTERNO\CLIPS\TODO . The rest is the same than with the above.

Now to the problem:

If you select , let's say 200 files, (could be small videos or pictures but never mixing each) and try to use shell-x to send them to "HIGHLIGHTS" folder using my batch files, the script sends them to "CLIPS" instead.
I'm going crazy with this as it also seems to crash the batch files sometimes too.
Same batch with less files works as intended, meaning instead of 200 files we select around 20, it works.
What I've discovered (or think so) is that the "CLIPS\TODO" folder containing all subfolders and cmd files for shell-x is "first" in the order.

To be more graphic on the structure:

[gif,mp4,mov,mpg,mpeg,avi,mkv,webm,ts,wmv,m4v,flv]\02.MOVER A EXTERNO
       |-- CLIPS
       |       |_A
       |         |_ "A.c.ms.cmd"
       |       |_B
       |         |_ "B.c.ms.cmd"
       |
       |-- HIGHLIGHTS
       |       |_A
       |         |_ "01A.c.ms.cmd"
       |       |_B
       |         |_ "02B.c.ms.cmd"

It seems that shell-x has some kind of race condition in which it searches for the given cmd file and instead of executing the correct one, it executes the first it finds with a similar name.

For example, given the structure above, if you execute RIGHT CLICK -> MOVER A EXTERNO -> HIGHLIGHTS -> A -> A.c.ms.cmd it will execute MOVER A EXTERNO -> CLIPS -> A -> 01A.c.ms.cmd instead because "CLIPS" is above "HIGHLIGHTS" and both cmd files have very similar names.
I did an experiment and changed the name from "HIGHLIGHTS" to "[HIGHLIGHTS]" so the folder goes first in the order, and it worked.
The problem with this approach is that I will be breaking "CLIPS" or other folders too.

I don't comprehend how shell-x works under the hood, but from my ignorance it looks like if it were using a diffuse search and executing the first diffuse result given the ordering of the folders, with diffuse I mean that it checks partially into a registry/table/dbase of some kind and matches the result inconsistently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions