Garbage in wincmd.ini: unwanted entries which I don't need at all

English support forum

Moderators: white, Hacker, petermad, Stefan2

qzute
Junior Member
Junior Member
Posts: 3
Joined: 2024-01-05, 17:41 UTC

Garbage in wincmd.ini: unwanted entries which I don't need at all

Post by *qzute »

I get too much garbage in wincmd.ini here:

[Command line history]
[LastTracks]
[LeftHistory]
[lefttabs]
[MkDirHistory]
[NewFileHistory]
[rename]
[RenameSearchFind]
[RenameSearchReplace]
[RenameTemplates]
[RightHistory]
[righttabs]
[SearchIn]
[SearchName]
[SearchText]
[Selection]

What should i change so that I will never get collect it again there?

Also I have garbage tcDirFrq.txt file and some treeinfo*.wc files.
I also need to get them away and never collect them again.
User avatar
Gral
Power Member
Power Member
Posts: 1467
Joined: 2005-01-26, 15:12 UTC

Re: Garbage in wincmd.ini

Post by *Gral »

Redirect all these sections to read only, empty file e.g.

Code: Select all

[Command line history]
RedirectSection=EMPTY.INI

[LastTracks]
RedirectSection=EMPTY.INI

[LeftHistory]
RedirectSection=EMPTY.INI

[lefttabs]
RedirectSection=EMPTY.INI
qzute
Junior Member
Junior Member
Posts: 3
Joined: 2024-01-05, 17:41 UTC

Re: Garbage in wincmd.ini

Post by *qzute »

Is that the only way? Can't use this.
Can I use RedirectSection=null, RedirectSection=0 or something like that?
User avatar
Dalai
Power Member
Power Member
Posts: 9395
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Garbage in wincmd.ini

Post by *Dalai »

Some history can be disabled via Options > Operation > Save on exit. The rest can be disabled via RedirectSection as shown by Gral. For more information on RedirectSection see TC help, section 4.b, wincmd.ini.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
beb
Senior Member
Senior Member
Posts: 435
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: Garbage in wincmd.ini

Post by *beb »

qzute wrote: 2024-01-05, 18:06 UTC ...Can't use this...
Out of curiosity, why not?
From my point of view, it's the most convenient way to deal with the 'garbage'.
You redirect all the things you consider garbage into the garbage.ini and forget it.
For me, it's an ideal scenario, far not all the tools provide similar functionality.
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
User avatar
Gral
Power Member
Power Member
Posts: 1467
Joined: 2005-01-26, 15:12 UTC

Re: Garbage in wincmd.ini

Post by *Gral »

qzute wrote: 2024-01-05, 18:06 UTC Is that the only way? Can't use this.
Can I use RedirectSection=null, RedirectSection=0 or something like that?
If you do this, files with these names will be created.
But you can use trick - redirect to existing directory name. (I'm not sure whether such a trick always work properly!)
User avatar
Stefan2
Power Member
Power Member
Posts: 4159
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Garbage in wincmd.ini

Post by *Stefan2 »

You can redirect to a path too:

Try e.g.

RedirectSection=%temp%\xFgvjty

RedirectSection=C:\Temp\hsltva



 
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3864
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Re: Garbage in wincmd.ini: unwanted entries which I don't need at all

Post by *sqa_wizard »

There is a smart solution using NUL device (a special virtual file that discards all data written to it):

Code: Select all

[MkDirHistory]
RedirectSection=NUL
NUL is part of the OS since DOS and still available at Windows :idea:
#5767 Personal license
qzute
Junior Member
Junior Member
Posts: 3
Joined: 2024-01-05, 17:41 UTC

Re: Garbage in wincmd.ini: unwanted entries which I don't need at all

Post by *qzute »

Does NUL cause any problems or not?
User avatar
Gral
Power Member
Power Member
Posts: 1467
Joined: 2005-01-26, 15:12 UTC

Re: Garbage in wincmd.ini: unwanted entries which I don't need at all

Post by *Gral »

It shouldn't
User avatar
beb
Senior Member
Senior Member
Posts: 435
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: Garbage in wincmd.ini: unwanted entries which I don't need at all

Post by *beb »

So the OP intends to not deal with garbage postfactum at all (even on RedirectSection=garbage.ini level), but to prevent its creation and storing preliminarily.
With that approach, the idea of RedirectSection=nul looks cool.
Going further that way, I made myself a user command that restarts TotalCommander without any settings:

Code: Select all

[em_noini]
cmd=%commander_exe% /i=nul /f=nul
[em_nul]
cmd=cm_exit,em_noini
That will be useful for testing purposes when a clean copy of TC is required.
It's quick since it allows the use of the existing installation without affecting it and without the need for a new installation.
Of course, it would prevent any settings adjustments since writing to .ini becomes unavailable.
So, if access to the settings is a must, the commands would be like this (this case implies %temp% cleanup when needed):

Code: Select all

[em_tempini]
cmd=%commander_exe% /i=%temp%\wincmd.ini /f=%temp%\wcx_ftp.ini
[em_temp]
cmd=cm_exit,em_tempini
Last edited by beb on 2024-01-06, 05:16 UTC, edited 1 time in total.
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: Garbage in wincmd.ini

Post by *Fla$her »

qzute wrote: 2024-01-05, 18:06 UTCIs that the only way?
See the answer in the German subforum.
Overquoting is evil! 👎
User avatar
beb
Senior Member
Senior Member
Posts: 435
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: Garbage in wincmd.ini

Post by *beb »

Fla$her wrote: 2024-01-06, 05:15 UTC See the answer in the German subforum.
I'm afraid the way described there is not bringing much happiness to the OP since she implies there's no interest in removing the 'garbage' -- the pretty reasonable idea is the garbage shouldn't have been created, to begin with.
Cheers
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: Garbage in wincmd.ini

Post by *Fla$her »

beb wrote: 2024-01-06, 05:43 UTC the pretty reasonable idea is the garbage shouldn't have been created, to begin with.
Pretty? :mrgreen:
This is a bad idea for me, because the templates and the history of the combo boxes in the current session give their advantages. And clearing the config after completing or starting will not allow outsiders to find out what the previous user used, which is a much more reasonable approach.
Last edited by Fla$her on 2024-01-06, 08:12 UTC, edited 1 time in total.
Overquoting is evil! 👎
User avatar
beb
Senior Member
Senior Member
Posts: 435
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: Garbage in wincmd.ini: unwanted entries which I don't need at all

Post by *beb »

beb wrote: 2024-01-06, 05:12 UTC So, if access to the settings is a must, the commands would be like this (this case implies %temp% cleanup when needed):

Code: Select all

[em_tempini]
cmd=%commander_exe% /i=%temp%\wincmd.ini /f=%temp%\wcx_ftp.ini
[em_temp]
cmd=cm_exit,em_tempini
And if the .ini(s) are already there while meant not to (when the new clean restart reqired):

Code: Select all

[em_tempini]
cmd=%commander_exe% /i=%temp%\wincmd.ini /f=%temp%\wcx_ftp.ini
[em_tempiniclean]
cmd=pwsh -command Get-ChildItem $env:Temp -recurse -include ('wincmd.ini','wcx_ftp.ini')|Remove-Item -force
[em_nul]
cmd=cm_exit,em_tempiniclean,em_tempini
or with [em_tempiniclean] put in cmd tongue:

Code: Select all

[em_tempiniclean]
cmd=%comspec% /q/c for /r %temp% %f in (wincmd.ini,wcx_ftp.ini) do del /q "%~ff"
And yet another (compact, and better) syntax for the said command:
Fla$her wrote: 2024-01-06, 09:40 UTC

Code: Select all

cmd=%comspec% /q/c del/q "%temp%\wincmd.ini" "%temp%\wcx_ftp.ini"
Edit: %/%% related cmd syntax fix. Thanks to Fla$her
Last edited by beb on 2024-01-06, 11:29 UTC, edited 2 times in total.
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
Post Reply