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
es.exe with regex from JScript
Re: es.exe with regex from JScript
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
-
- Posts: 35
- Joined: Sun Mar 08, 2015 11:05 pm
Re: es.exe with regex from JScript
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...
..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...
..which I then execute using the same technique
This works with the -r option.
Regards, AB
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);
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
Code: Select all
var objWShell = new ActiveXObject("WScript.Shell");
objWShell.Run("cmd /c C:\my.cmd", 0, true);
Regards, AB