Possible to start lister via commandline with a search value

English support forum

Moderators: petermad, Stefan2, white, Hacker

Post Reply
Stormer
Junior Member
Junior Member
Posts: 4
Joined: 2026-02-03, 14:02 UTC

Possible to start lister via commandline with a search value

Post by *Stormer »

I like working with total commander and lister a lot, I was wondering if its possible to start lister via the commandline with a search value applied (so you can hit F3 like the regular total commander find experience).

I found the link:

https://www.ghisler.com/lister/

but that does not specify posiblities for passing through a search value. Is it possible to do so?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 51909
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Possible to start lister via commandline with a search value

Post by *ghisler(Author) »

No, unfortunately not. You could start Lister with its own wincmd.ini file and put the search value in the search history, then you could press F3 to search with that value.
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 3425
Joined: 2020-01-18, 04:03 UTC

Re: Possible to start lister via commandline with a search value

Post by *Fla$her »

with its own wincmd.ini file
What do you mean? RedirectSection?
put the search value in the search history, then you could press F3 to search with that value.
But the entry for key 0 in the [SearchText] section does not activate it for searching; it only replaces it in the combobox list.
Is it possible to send some kind of message to the TC window that would make the search value active in memory?
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 16669
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Possible to start lister via commandline with a search value

Post by *petermad »

2ghisler(Author)
and put the search value in the search history, then you could press F3 to search with that value.
That does not seem to be correct, if I launch standalone Lister with the command line parameters:/i=path_to_ini_file /S=L path_to_file_to_open and then press F3 I will have to roll down the "Enter search text" combo box and choose the saved search string - it does NOT appear automatically in that combo box.
License #524 1994
Danish TC Translator
TC 11.57b1 32+64bit on Windows XP 32bit & Windows 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1405a
TC 3.62 on Android 6, 13, 15 & 16
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Gral
Power Member
Power Member
Posts: 1688
Joined: 2005-01-26, 15:12 UTC

Re: Possible to start lister via commandline with a search value

Post by *Gral »

Fla$her wrote: 2026-02-06, 06:22 UTC
with its own wincmd.ini file
What do you mean? RedirectSection?
Any ini file, with this or any other name, used with the "/i=" option, containing the value desired in this situation under appropiate section and key.
Fla$her
Power Member
Power Member
Posts: 3425
Joined: 2020-01-18, 04:03 UTC

Re: Possible to start lister via commandline with a search value

Post by *Fla$her »

Gral wrote: 2026-02-07, 04:59 UTC used with the "/i=" option, containing the value desired in this situation under appropiate section and key.
From that answer it's difficult to understand that it's about /S=L. As far as I understand, in this case it doesn't matter whether /i is used or not, given the creation of a new process, since the necessary sections are reread, including from the main config. In this case, there is no need to call a separate process to set the last value; F3 (cm_List) is enough. The current value, as I already wrote, cannot be set using an ini.
Overquoting is evil! 👎
User avatar
beb
Power Member
Power Member
Posts: 633
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: Possible to start lister via commandline with a search value

Post by *beb »

2Stormer
I've tried a functional example technique as follows:
  • custom user command one (usercmd.ini), PowerShell-based:

    Code: Select all

    [em_get_f3_ini_from_clipboard]
    cmd=pwsh -c
    param=New-Item -path $env:Temp -name 'f3.ini' -type file -force -value ('[SearchText]'+[Environment]::NewLine+'0='+(Get-Clipboard))|Out-Null
  • custom user command two (usercmd.ini), TotalCommander native:

    Code: Select all

    [em_run_standalone_lister_with_f3_ini]
    cmd=%commander_exe% /i="%Temp%/f3.ini"
    param=/S=L %P%N
  • custom toolbar button with the said commands chain:

    Code: Select all

    TOTALCMD#BAR#DATA
    em_get_f3_ini_from_clipboard,em_run_standalone_lister_with_f3_ini
    
    WCMICON2.DLL
    run standalone lister with a predefined search query
    
    0
    -1
    
Operation manual:
  1. Copy your search query to the clipboard (Ctrl+C)
  2. Place the cursor on the file in question
  3. Hit the button
  4. In the newly opened Lister's window, hit any key to enter find mode (F3|F5|F7).
  5. In the find mode pop-up window, choose your query from the drop-down list
  6. Proceed as needed
Alas, as others have already mentioned here, the drop-down list step is inevitable evil with this method.

Explanation:
  1. [em_get_f3_ini_from_clipboard] command creates the brand new "f3.ini" file (in your %Temp% directory), with the only contents of the proper ini section ('[SearchText]'), and a single (initial) entry ('0=value'), where the 'value' is your search query that is retrieved from the clipboard
  2. [em_run_standalone_lister_with_f3_ini] command is self-explanatory; it just runs Lister with the file under the cursor and with the ready-to-use search query available in the drop-down list
Note:
If you'd prefer to keep the temporary ini within the TotalCommander folder, change "$env:Temp" and "%Temp%" to "$env:commander_path" and "%commander_path%" respectively.
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Windows 11/Android 16
Fla$her
Power Member
Power Member
Posts: 3425
Joined: 2020-01-18, 04:03 UTC

Re: Possible to start lister via commandline with a search value

Post by *Fla$her »

2beb
And what does the clipboard have to do with it? It was written "with a search value applied", meaning a constant, so slow PowerShell isn't needed here. However, it's not needed anyway, since this can be done with a simple button:

Code: Select all

TOTALCMD#BAR#DATA
%comspec% /q/u/c >"%COMMANDER_INI_PATH%\F3.ini" (echo [SearchText]&&echo 0^=%$CLIPNAME_NEQ1%)

wcmicon2.dll,67
Create F3.ini + clipboard text

1
But I don’t see any point in this, since nothing prevents you from using Ctrl+V instead of Down after opening the dialog. Why did such a strange idea even occur to you? 😲

The most logical thing would be to just open the search dialog right after F3, paste the necessary text, and execute it.
Button codes with TCFS2:
For TC x32:

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Addons\TCFS2\TCFS2.exe /ef "tcm(2933,1) delay(50) eval(send_wait(^f,findwnd(TLister))) eval(settext_wait(`ANYTEXT`,findwnd(Edit,,findwnd(TMyComboBox,,findwnd(TSEARCHTEXT))))) sendmsg(findwnd(TButton,,findwnd(TSEARCHTEXT),2),$f5)"

wcmicon2.dll,27
Text viewing + auto-search for 'ANYTEXT' (TC x32)

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Addons\TCFS2\TCFS2.exe /ef "tcm(2933,1) delay(50) eval(send_wait(^f,findwnd(TLister))) eval(settext_wait(`%$CLIPNAME_NEQ1%`,findwnd(Edit,,findwnd(TMyComboBox,,findwnd(TSEARCHTEXT))))) sendmsg(findwnd(TButton,,findwnd(TSEARCHTEXT),2),$f5)"

wcmicon2.dll,45
Text viewing + auto-search for clipboard string (TC x32)
For TC x64:

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Addons\TCFS2\TCFS2.exe /ef "tcm(2933,1) delay(50) eval(send_wait(^f,findwnd(TLister))) eval(settext_wait(`ANYTEXT`,findwnd(Edit,,findwnd(LCLComboBox,,findwnd(TSEARCHTEXT))))) sendmsg(findwnd(Button,,findwnd(TSEARCHTEXT),5),$f5)"

wcmicon2.dll,27
Text viewing + auto-search for 'ANYTEXT' (TC x64)

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Addons\TCFS2\TCFS2.exe /ef "tcm(2933,1) delay(50) eval(send_wait(^f,findwnd(TLister))) eval(settext_wait(`%$CLIPNAME_NEQ1%`,findwnd(Edit,,findwnd(LCLComboBox,,findwnd(TSEARCHTEXT))))) sendmsg(findwnd(Button,,findwnd(TSEARCHTEXT),5),$f5)"

wcmicon2.dll,45
Text viewing + auto-search for clipboard string (TC x64)
Slightly less reliable solution for x32+x64:

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Addons\TCFS2\TCFS2.exe /ef "set_tcini(Searchtext,0,`ANYTEXT`) tcm(2933,1) delay(50) eval(send_wait(^f,findwnd(TLister))) eval(send_wait({DOWN}{ENTER},findwnd(TSEARCHTEXT)))"

wcmicon2.dll,27
F3 + auto-search for 'ANYTEXT'

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Addons\TCFS2\TCFS2.exe /ef "set_tcini(Searchtext,0,`%$CLIPNAME_NEQ1%`) tcm(2933,1) delay(50) eval(send_wait(^f,findwnd(TLister))) eval(send_wait({DOWN}{ENTER},findwnd(TSEARCHTEXT)))"

wcmicon2.dll,45
F3 + auto-search for clipboard string
Overquoting is evil! 👎
Stormer
Junior Member
Junior Member
Posts: 4
Joined: 2026-02-03, 14:02 UTC

Re: Possible to start lister via commandline with a search value

Post by *Stormer »

Thanks guys for the extend answers, really appreciate it
Stormer
Junior Member
Junior Member
Posts: 4
Joined: 2026-02-03, 14:02 UTC

Re: Possible to start lister via commandline with a search value

Post by *Stormer »

And would the trick with TCFS2 also work for outside total commander, say i want to open lister via Everything (voidtools) (with the searchvalue coming from the clipboard)
Fla$her
Power Member
Power Member
Posts: 3425
Joined: 2020-01-18, 04:03 UTC

Re: Possible to start lister via commandline with a search value

Post by *Fla$her »

No. TCFS2 is an addon. The feature of addons is that they only work with the program they were written for. For new processes, you'll have to use other automation tools, such as Autorun (with the AutorunLoadInSubprocess directive).
Overquoting is evil! 👎
User avatar
Horst.Epp
Power Member
Power Member
Posts: 7313
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Possible to start lister via commandline with a search value

Post by *Horst.Epp »

Stormer wrote: 2026-02-12, 15:17 UTC And would the trick with TCFS2 also work for outside total commander, say i want to open lister via Everything (voidtools) (with the searchvalue coming from the clipboard)
No need for this.
You can define Custom commands in Everything which start TC Lister with the file from the search results.
Windows 11 Home, Version 25H2 (OS Build 26200.7922)
TC 11.57 beta2 x64 / x86
Everything 1.5.0.1406a (x64), Everything Toolbar 2.1.2, Listary Pro 6.3.6.99
QAP 12.2 x64
Stormer
Junior Member
Junior Member
Posts: 4
Joined: 2026-02-03, 14:02 UTC

Re: Possible to start lister via commandline with a search value

Post by *Stormer »

Horst.Epp wrote: 2026-02-12, 15:56 UTC
Stormer wrote: 2026-02-12, 15:17 UTC And would the trick with TCFS2 also work for outside total commander, say i want to open lister via Everything (voidtools) (with the searchvalue coming from the clipboard)
No need for this.
You can define Custom commands in Everything which start TC Lister with the file from the search results.
would that also allow for passing the search value from the clipboard to lister?
Fla$her
Power Member
Power Member
Posts: 3425
Joined: 2020-01-18, 04:03 UTC

Re: Possible to start lister via commandline with a search value

Post by *Fla$her »

Horst.Epp wrote: 2026-02-12, 15:56 UTC start TC Lister with the file from the search results.
He needs to search not for a file, but for text within a file, using the built-in search dialog.
Overquoting is evil! 👎
User avatar
Horst.Epp
Power Member
Power Member
Posts: 7313
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Possible to start lister via commandline with a search value

Post by *Horst.Epp »

Stormer wrote: 2026-02-12, 15:59 UTC
Horst.Epp wrote: 2026-02-12, 15:56 UTC
Stormer wrote: 2026-02-12, 15:17 UTC And would the trick with TCFS2 also work for outside total commander, say i want to open lister via Everything (voidtools) (with the searchvalue coming from the clipboard)
No need for this.
You can define Custom commands in Everything which start TC Lister with the file from the search results.
would that also allow for passing the search value from the clipboard to lister?
Why should I need that ?
I can search for a clipboard entry in Everything
and then view the results entry with TC.
Windows 11 Home, Version 25H2 (OS Build 26200.7922)
TC 11.57 beta2 x64 / x86
Everything 1.5.0.1406a (x64), Everything Toolbar 2.1.2, Listary Pro 6.3.6.99
QAP 12.2 x64
Post Reply