wsl and content searching via command-line

Discussion related to "Everything" 1.5 Alpha.
Post Reply
rbro
Posts: 5
Joined: Wed Nov 24, 2021 3:11 pm

wsl and content searching via command-line

Post by rbro »

First, thank you for creating Everything. It's pretty amazing.

I'm running into an obscure issue with ES. I'm not sure if it's an issue directly with ES, but I was hoping to get your feedback on how to narrow it down:

I am running Everything 1.5.0.1352a and ES 1.1.0.26. I have content indexing enabled in certain directories. I've written a script that calls es.exe to do a content search, and it works great. The issue comes up when I try to call es.exe from WSL2, where I'm running a Linux distribution:

https://learn.microsoft.com/en-us/windo ... from-linux

If I do a search for text without spaces, it works correctly, but if I do a search for text with spaces, no results are returned.

To reproduce:

Create a test.txt file in Windows with:

test123
test 123

When I run these 2 commands from a Windows Command Prompt, the file is returned in both cases:

c:\es\es.exe -instance 1.5a content:"test123"
c:\es\es.exe -instance 1.5a content:"test 123"

From Linux, this command returns the file:

/mnt/c/es/es.exe -instance 1.5a content:"test123"

but this command returns no results:

/mnt/c/es/es.exe -instance 1.5a content:"test 123"

I've also tried these commands, but they don't work either:

/mnt/c/es/es.exe -instance 1.5a content:\"test\ 123\"
/mnt/c/es/es.exe -instance 1.5a "content:\"test 123\""

I'm not sure if I need to quote the arguments differently. Or is there a way I can print out exactly what arguments es.exe is seeing?

Thanks for your help.

Ryan
therube
Posts: 4955
Joined: Thu Sep 03, 2009 6:48 pm

Re: wsl and content searching via command-line

Post by therube »

"test 123"
Did you try single quotes
'test 123'



("wsl"

PS: I can run (mentioned on the MS page):

C:\DEV\LOCATE\14.4.TESTING - Copy>ipconfig | grep IPv4 | cut -d: -f2
10.0.0.9

without Win10, without wsl, with only a few basic, stand-alone UNIX utilities [& a few associated libs] - in Win7 [& XP] ;-).)
rbro
Posts: 5
Joined: Wed Nov 24, 2021 3:11 pm

Re: wsl and content searching via command-line

Post by rbro »

Yes, I've tried these variations, but none return any results:

/mnt/c/es/es.exe -instance 1.5a content:'test 123'
/mnt/c/es/es.exe -instance 1.5a 'content:test 123'
/mnt/c/es/es.exe -instance 1.5a 'content:"test 123"'
/mnt/c/es/es.exe -instance 1.5a "content:'test 123'"
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: wsl and content searching via command-line

Post by NotNull »

Can't test (no WSL2 installed), but does any of the following work for you?

Code: Select all

/mnt/c/es/es.exe   -instance 1.5a   content:"""test 123"""
/mnt/c/es/es.exe   -instance 1.5a   content:"test\ 123"

rbro
Posts: 5
Joined: Wed Nov 24, 2021 3:11 pm

Re: wsl and content searching via command-line

Post by rbro »

Neither of those work either - no results are returned. It's something with the space as if I remove the space, then the results are returned.
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: wsl and content searching via command-line

Post by NotNull »

Yeah, WSL will have its own mechanism for escaping spaces/quoting, which might get stripped before arriving at ES/Everything.


A trial & error method would be to enable the debug console in Everything (menu:Tools > Debug > Console) to see how your search arrives in Everything.
Searches are shown in green colour.


To close the debug console: menu:Tools > Debug > Console
rbro
Posts: 5
Joined: Wed Nov 24, 2021 3:11 pm

Re: wsl and content searching via command-line

Post by rbro »

Thanks, I didn't know about the Debug console.

When I do:

/mnt/c/es/es.exe -instance 1.5a content:"test 123"

it comes through as:

IPC: execute query: "content:test 123"

Ignoring WSL2, if I wanted to quote my entire search screen from a Windows Command Prompt, what is the syntax? I tried this, but it doesn't find any results:

c:\es\es.exe -instance 1.5a "content:"test123""

but also, this doesn't find anything either with no spaces.

c:\es\es.exe -instance 1.5a "content:test123"

Only this works:

c:\es\es.exe -instance 1.5a content:test123

Could it be the argument parsing in es.exe?
therube
Posts: 4955
Joined: Thu Sep 03, 2009 6:48 pm

Re: wsl and content searching via command-line

Post by therube »

Without looking...

One of the (Everything) command line switches, maybe it is -s or -s* ?, sends the rest of its' params literally.
If the same applies to ES, also not sure, but that might be worth pursuing.

So something like
es.exe -instance 1.5a -s content:"test 123"
.
rbro
Posts: 5
Joined: Wed Nov 24, 2021 3:11 pm

Re: wsl and content searching via command-line

Post by rbro »

When I run that from a Windows command prompt, Everything sees it as:

IPC: execute query: content:"test 123"

When I run it from WSL2, it sees:

IPC: execute query: "content:test 123"

Does the es.exe command line argument processor not allow the entire search text to be quoted? That might be why this is happening because even this doesn't work from Windows:

c:\es\es.exe -instance 1.5a "content:test123"

as Everything logs the same as the WSL2 request above with the entire string quoted:

IPC: execute query: "content:test123"
Post Reply