Use %COMPUTERNAME% in es.ini

Discussion related to "Everything" 1.5 Alpha.
Post Reply
EricB
Posts: 53
Joined: Wed Jun 26, 2013 8:56 am

Use %COMPUTERNAME% in es.ini

Post by EricB »

Hello,

I'm using Everything (and es.exe) in a portable, shared folder (dropbox) over multiple computers. The everything instance is launched by a batch file which contains:

Code: Select all

start everything64.exe -config %COMPUTERNAME%.ini -instance %COMPUTERNAME% -db %COMPUTERNAME%.db
This works very well, every machine gets its own named instance (and ini/db files). I just found out that es.exe can also use es.ini to save settings, but it does not seem to support environment variable expansion: if I use instance=%COMPUTERNAME% in the ini, I get the "Error 8: Everything IPC window not found. Please make sure Everything is running." when launching es.exe.

Would it be possible to add this to es.exe? Tested this with version 1.1.0.23.
void
Developer
Posts: 16672
Joined: Fri Oct 16, 2009 11:31 pm

Re: Use %COMPUTERNAME% in es.ini

Post by void »

I will consider support for environment variables in the ES.ini
Thank you for your suggestion.


For now, please try a bat file, eg: ES.bat

es.exe -instance %COMPUTERNAME%
EricB
Posts: 53
Joined: Wed Jun 26, 2013 8:56 am

Re: Use %COMPUTERNAME% in es.ini

Post by EricB »

Void, thanks for considering this. I'm currently using es in a batch, but to get more parameters working I have to use

Code: Select all

es.exe -instance %COMPUTERNAME% %1 %2 %3 %4
If the instance (as expanded variable) is picked up from the ini it would be possible to use es.exe directly.
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: Use %COMPUTERNAME% in es.ini

Post by NotNull »

You might want to take a look at the following INI setting; it should take away most - if not all - of the issues:
db_multi_user_filename

Use a unique filename for the database for each computer and user. Set to 1 to enable. Set to 0 to disable. Might be useful when using the portable version on different computers.


EricB wrote: Wed Feb 02, 2022 7:52 am Void, thanks for considering this. I'm currently using es in a batch, but to get more parameters working I have to use

Code: Select all

es.exe -instance %COMPUTERNAME% %1 %2 %3 %4
If the instance (as expanded variable) is picked up from the ini it would be possible to use es.exe directly.
You can use es.exe -instance "%COMPUTERNAME%" %*.
%* = all parms



If you don't like the db_multi_user_filename approach, I would go with @void's suggestion:
  • Rename ES.exe to EStool.exe (or similar)
  • Create a batchfile ES.cmd in that same folder with content:

    Code: Select all

    @"%~dp0\EStool.exe"    -instance "%COMPUTERNAME%"     %*
Now you can run
es -getresultcount
without speciying an instance.


(all untested, btw)
EricB
Posts: 53
Joined: Wed Jun 26, 2013 8:56 am

Re: Use %COMPUTERNAME% in es.ini

Post by EricB »

@ NotNull,

Your batch statement is way neater than my makeshift approach (I hardly ever do anything with batch) and is working right out of the box. The %* parameter trick is new to me, but noted for future reference. Thanks!

I'll look into db_multi_user_filename setting and see if that works for me in a convenient way.
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: Use %COMPUTERNAME% in es.ini

Post by NotNull »

EricB wrote: Wed Feb 02, 2022 11:27 am and is working right out of the box.
That's good news! I usually forget a (double-) quote here and there. There is still hope for me :)
Post Reply