es.exe syntax problems

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
2530
Posts: 14
Joined: Mon Jun 27, 2022 4:49 pm

es.exe syntax problems

Post by 2530 »

Hello,
Fantastic tool indeed, use it every day. But with es.exe, I've got lots of syntax problems. From here,

https://www.voidtools.com/support/every ... interface/ , I get

es.exe [options] [search text]

so this would mean that ALL options would be BEFORE the searchtext, but in fact, some options work, or even MUST (?) stand BEHIND the searchtext, and at least:
es.exe options searchtext -export-txt exportfilepath

and I have also seen other options BEHIND the searchtext, instead of them being BEFORE it.

Also, I think I should group alternatives within the searchtext with ().

The following command works fine within Everything (not: es.exe), I then sort manually by clicking on the "path" column:
.iso ((k:|o:|q:|t:|w:)\dvd\) | (i:\comedy dvd\)
and means, search for .iso AND
EITHER k/o/q/t/w:\dvd\ OR i:\comedy dvd\

Now the same search for es.exe would be, according to me:

"c:\es.exe" -r -s .iso ((k:|o:|q:|t:|w:)\dvd\) | (i:\comedy dvd\)) -export-txt "d:\downloads\zDVDs.txt"

and I ALWAYS get "-export-txt was unexpected at this time.", independently of the following alternatives:

- without the ""
- without the global (), so that I just have (...) | (...)
- up front, just the -r for "search"
- -s -r (i.e. in the other order, instead of -r -s)
- the -s (for sort by fullpath) left out
- the -s at the end
- in almost any possible combination.

Please explain what I do wrong here, and possibly elsewhere with es.exe, most of the time I don't get the command to be passed thru; ironically, with regex it's much easier.
horst.epp
Posts: 1447
Joined: Fri Apr 04, 2014 3:24 pm

Re: es.exe syntax problems

Post by horst.epp »

Who said that Everything.exe and es.exe have the same command line parameters ?
Just run es.exe without any parameter to see whats available.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: es.exe syntax problems

Post by NotNull »

2530 wrote: Mon Jun 27, 2022 5:09 pm Now the same search for es.exe would be, according to me:

"c:\es.exe" -r -s .iso ((k:|o:|q:|t:|w:)\dvd\) | (i:\comedy dvd\)) -export-txt "d:\downloads\zDVDs.txt"
  • On the command-line special characters, like the "|" need to be escaped or used with a different quoting mechanism.
  • If you want to use regular expressions (that is what the -r enables), you need to be aware that the .iso is not part of the regex.
  • Also: as the backslash is part of the regex sytax, a literal backslash needs to be escaped: \\
  • Spaces can be tricky too.


    With that:

    Code: Select all

    "c:\es.exe" ext:iso   regex:"[koqtw]:)\\dvd\\"^|"i:\\comedy dvd\\" 
    If you want "all-regex":

    Code: Select all

    "c:\es.exe" -r ("[koqtw]:)\\dvd\\"^|"i:\\comedy dvd\\").*\.iso$
    In Everything, select Menu:Help > Regex Syntax for details




    Without regular expressions:

    Code: Select all

    "c:\es.exe"   """  ext:iso    <k:|o:|q:|t:|w:>\dvd\|"i:\\comedy dvd\"   """
    

    (Largely untested, but at least one of these should help you out. I hope .. :)
2530
Posts: 14
Joined: Mon Jun 27, 2022 4:49 pm

Re: es.exe syntax problems

Post by 2530 »

I don't understand Horst, whilst NotNull, thank you!, you helped me discover a misunderstanding of mine:


Horst:
In the above link, it is stated,
"Search syntax
ES uses the Everything search syntax."

NotNull:
And in the above link, it is stated,
"These options will work with any version of Everything.
-r <search> AND!!!!!!
-regex <search>
Search using regular expressions.
Escape spaces with double quotes."

Thus I had, erroneously, assumed that
-r regularsearchstring
-regex regexsearchstring
(-r for seaRch, -s because -s is used for sort-by-path).

Thus, I always used the -r option for regular search, normal search, and -regex for regexsearch, the AND above NOT being in the above link.

That's why my regex searches worked - I know about regex -, and my regular searches, always with -r (!), only worked in those rare cases where the syntax was so simple that the -r (for regex, when I thought it was for regular!) didn't intervene for falsifying the code.

Thus, regular search is WITHOUT option, not with -r, -r being an abbreviation for -regex.

Once you know that, everything becomes simple again.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: es.exe syntax problems

Post by NotNull »

Forgot to mention:
Also, I think I should group alternatives within the searchtext with ().
In Everything, < and > are used for grouping. See my last example.
(Everything has a setting to enable () for grouping too, but that is not recommended for most cases)
2530
Posts: 14
Joined: Mon Jun 27, 2022 4:49 pm

Re: es.exe syntax problems

Post by 2530 »

Thank you, NotNull, for specifying that, too; I had just forgotten to mention it, and then editing wasn't possible, my posts being screened first.

Unfortunately, I do NOT get the regular es.exe syntax.

First, double << are not accepted:
"c:\es.exe" -s .iso <<k:|o:|q:|t:|w:>\dvd\> | <i:\comedy dvd\> -export-txt "d:\downloads\zDVDs.txt"
gives the error "<< not expected this time"

Thus, I admit that it's not possible, in regular es.exe search, to have a group within a group, I would need regex search then. (Btw, spaces around the "<" do not change anything, anywhere.)

Second, I thus simplified my try (always regular, not regex):
"c:\es.exe" -s <k:|o:|q:|t:|w:> .iso \dvd\ -export-txt "d:\downloads\zDVDs.txt"
The "|" are for "OR" and, of course, should NOT be "escaped".

Now, in all variants, this gives "The system cannot find the path specified.":
- the target file exists beforehand
- the target file is to be created by the command
- I replace the "\" in the target file by "/"
- I put the -s from before the search string to the very end

So this does NOT work, whilst a simple
Third:
"c:\es.exe" k: .iso \dvd\ -export-txt "d:\downloads\zDVDs.txt" -s
WILL work as expected, even with the -s at the end, when the above link says all options are to be placed before the search string.


Thus, no grouping whatsoever would work in es.exe?
Since 1 does not work (group in group), and 2 does not work either (simple group), whilst 3 works as expected.

I really don't understand it.
2530
Posts: 14
Joined: Mon Jun 27, 2022 4:49 pm

No grouping in es.exe?

Post by 2530 »

Possible spaces between or around the "<" do not make a difference. Possible spaces around the "|" do not make a difference. Sort option -s before the search string or as very last element does not make a difference. Leaving out the "" does not make a difference.

1) Double grouping (group in group) does not seem to be possible, since the following


"c:\es.exe" -s .iso <<k:|o:|q:|t:|w:>\dvd\> | <i:\comedy dvd\> -export-txt "d:\downloads\zDVDs.txt"

gives the error "<< not expected this time"

2) Not even simple grouping seems to work in my case:


"c:\es.exe" -s <k:|o:|q:|t:|w:> .iso \dvd\ -export-txt "d:\downloads\zDVDs.txt"
or
c:\es.exe < k: | o: | q: | t: | w: > .iso \dvd\ -export-txt d:\downloads\zDVDs.txt -s


gives the error "The system cannot find the path specified."


3) Just a simple (no grouping but otherwise identical)

"c:\es.exe" k: .iso \dvd\ -export-txt "d:\downloads\zDVDs.txt" -s

works as expected (no error, writes the correct output into the output file).
void
Developer
Posts: 16747
Joined: Fri Oct 16, 2009 11:31 pm

Re: No grouping in es.exe?

Post by void »

Please escape <, > and | with ^< ^> and ^|

Code: Select all

"c:\es.exe" .iso ^<^<k:^|o:^|q:^|t:^|w:^>\dvd\^> ^| ^<i:\comedy dvd\^> -export-txt "d:\downloads\zDVDs.txt"
Without the ^ escape, < and > will redirect input/output and | will pipe output to another program.


-s is an Everything GUI command line option and is not needed for ES.
The search syntax in ES is the same as the search syntax in the Everything GUI.
The command line options are different between ES and the Everything GUI.

ES command line options.
Everything GUI command line options.
Search syntax.
Escaping search syntax in ES.
2530
Posts: 14
Joined: Mon Jun 27, 2022 4:49 pm

Re: es.exe syntax problems

Post by 2530 »

Thank you so much for these clarifications and for this absolutely brilliant tool, void!

In general, special chars (here < and | and more) are escaped when they are "text", to distinguish them from "code", so I would not have assumed es.exe is so different from the search line in your GUI (main program).

And thank you very much for your very kind help here!!!
Post Reply