Command Search Syntax for Old Log Files

General discussion related to "Everything".
Post Reply
raywood
Posts: 22
Joined: Fri Apr 29, 2011 7:42 pm

Command Search Syntax for Old Log Files

Post by raywood »

I have a copy of everything.exe in C:\Windows.
My batch file works with this:

Code: Select all

start "" everything -search "C: *.log !folder: !dm:today"
but not with this:

Code: Select all

start "" everything -search "C: *.log !folder: !dm:today" !dm:yesterday"
Is there a better way?
horst.epp
Posts: 1344
Joined: Fri Apr 04, 2014 3:24 pm

Re: Command Search Syntax for Old Log Files

Post by horst.epp »

Strange location for installing a tool.
For what reason do you need a batch file with the Start command ?
raywood
Posts: 22
Joined: Fri Apr 29, 2011 7:42 pm

Re: Command Search Syntax for Old Log Files

Post by raywood »

Good questions. But off-topic.
horst.epp
Posts: 1344
Joined: Fri Apr 04, 2014 3:24 pm

Re: Command Search Syntax for Old Log Files

Post by horst.epp »

raywood wrote: Sun Nov 12, 2023 5:10 pm Good questions. But off-topic.
You asked "Is there a better way?"
We can't answer your basic question
as you don't tell us for what reason you need a batch with the start command.
NotNull
Posts: 5260
Joined: Wed May 24, 2017 9:22 pm

Re: Command Search Syntax for Old Log Files

Post by NotNull »

There is an extra double-quote in your second syntax. Try it with:

Code: Select all

start "" everything -search "C: *.log !folder: !dm:today !dm:yesterday"
raywood wrote: Sun Nov 12, 2023 4:16 pm Is there a better way?

Code: Select all

start "" everything.exe   -search   "ext:log   dm:<yesterday"
ext: will search only in files, so no more need for !folder: (FWIW: !folder: could also be replaced with file: )
(all untested, btw)


Did you find added benefit in installing Everything in the Windows folder? Just curious ...
raywood
Posts: 22
Joined: Fri Apr 29, 2011 7:42 pm

Re: Command Search Syntax for Old Log Files

Post by raywood »

Dumb mistake. Thank you. Yes, without the superfluous double quote, it works.

Your other suggestion works too.

Curious: is there an addition that would make these sort by Date Modified descending? Also, is there an easy way to change the less-than date from yesterday to something like a week ago? Asking just in case there's an easy answer that I'm overlooking; not wanting to impose on your time.

I didn't install Everything in C:\Windows. Like I say, I just put a copy of everything.exe there. Portable executables (i.e., not requiring .dlls etc.; presumably BATs too, though I keep mine elsewhere) and .lnk files work there or, I think, in C:\Windows\System32. So then, using your example, it's just:

Code: Select all

start "" everything -search "ext:log dm:<yesterday"
No need for the ".exe" and no need to specify path or add to PATH. So, you know,

Code: Select all

start Firefox "https://www.google.com/maps/@2.3940998,-1.0336775,4z"
See also other examples:
https://raywoodcockslatest.wordpress.co ... atch-file/
NotNull
Posts: 5260
Joined: Wed May 24, 2017 9:22 pm

Re: Command Search Syntax for Old Log Files

Post by NotNull »

raywood wrote: Sun Nov 12, 2023 7:43 pm is there an addition that would make these sort by Date Modified descending?

Code: Select all

Everything.exe -sort "Date Modified" -sort-descending   -search   "ext:log   dm:<yesterday"
Command-line syntax

raywood wrote: Sun Nov 12, 2023 7:43 pm Also, is there an easy way to change the less-than date from yesterday to something like a week ago?
See the Search Syntax and more specifically the Date Syntax and the Date Constants.

raywood wrote: Sun Nov 12, 2023 7:43 pm [...]portable executables]..]
Thanks for the explanation!

raywood wrote: Sun Nov 12, 2023 7:43 pm No need for the ".exe"
There is a very valid reason to add the extension nevertheless.
The number of times I encounter people running into "unexplainable" issues because they named a batchfile the same as one of the executables that is called in this batchfile ...
Like netsh.bat calling netsh (without the .exe extension). That will end up starting the netsh.bat all over again (and again and ..)

Therefor I make a habit out of adding the file extension.
Post Reply