es.exe with regex from JScript

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
aussieboykie
Posts: 35
Joined: Sun Mar 08, 2015 11:05 pm

es.exe with regex from JScript

Post by aussieboykie »

I am using a JScript to run a query using es.exe and writing the output to a temp file. When I execute the following non-regex query..

es.exe -export-txt C:\Users\Me\AppData\Local\Temp\es.txt thunderbird.exe

..the expected output is written correctly to the es.txt temp file. However, when I use the -r option to introduce regex into the mix...

es.exe -r -export-txt C:\Users\Me\AppData\Local\Temp\es.txt thunderbird.exe

..nothing is written to the temp file. Executing exactly the same regex query from a DOS command line works just fine.

Any idea what I might be doing wrong?

Regards, AB
ovg
Posts: 294
Joined: Thu Oct 27, 2016 7:19 pm

Re: es.exe with regex from JScript

Post by ovg »

I maybe wrong, but shouldn't you escape "\" with "\" when calling from JS?

Code: Select all

C:\\Users\\Me\\AppData\\Local\\Temp\\es.txt thunderbird.exe
aussieboykie
Posts: 35
Joined: Sun Mar 08, 2015 11:05 pm

Re: es.exe with regex from JScript

Post by aussieboykie »

That would not explain how or why it works without the -r option.

Interestingly, after further monkeying around, I have been able to get it working using a different approach. The way I was doing it is...

Code: Select all

var objWShell = new ActiveXObject("WScript.Shell");
objWShell.Run("cmd /c " + str, 0, true);
..where str is along the lines of..

pushd c:\esfolder & es.exe -options search-term & popd

I changed to create a three line C:\my.cmd file...

Code: Select all

pushd c:\esfolder
es.exe -options search-term
popd
..which I then execute using the same technique

Code: Select all

var objWShell = new ActiveXObject("WScript.Shell");
objWShell.Run("cmd /c C:\my.cmd", 0, true);
This works with the -r option.

Regards, AB
Post Reply