Second user? How to [link?] .ini & .br2 & .BAR to .

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
windunce
Junior Member
Junior Member
Posts: 12
Joined: 2012-01-26, 16:42 UTC

Second user? How to [link?] .ini & .br2 & .BAR to .

Post by *windunce »

Brought home a brand new computer for my wife.

She was the initial single user configured.

I installed the latest TC64 and checked [I think?] to use
C:\Users\Wife\AppData\Roaming\GHISLER\
as the 'Storage?' folder for the .ini Settings and .br2 Button Bar.

Spent the usual 45 minutes configuring all the Button and their icons
and the list of .ini parameters.

Everything went well and I smiled.

Then I enabled the Admin Account and after about a hour or so,
realized a parameter unbeknownst to me relegated that User's
'Storage?' folder to C:\Program Files\Total Commander\

So, is there anyway I can make User/Admin's configuration files to
'link?' to c:\Users\Administrator\AppData\Roaming\GHISLER\default.br2
without a reinstallation?

Thanks in advance for ay help with this issue.

Sincerely Yours
Windunce
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

http://www.totalcmd.net/plugring/inireloc.html

BTW bar file is .BAR and not .BR2 (it is only icon cache). And, I recommend to create separate BAR files instead of using default one.

Also, you can use some common part of wincmd.ini in order to make it easier to configure plugins etc. You only need to enable redirection for user-specific sections (help section 4.b, keys AlternateUserIni and RedirectSection; in such case you may want to keep main wincmd.ini in TC dir, so UseIniInProgramDir=7 would help here).
windunce
Junior Member
Junior Member
Posts: 12
Joined: 2012-01-26, 16:42 UTC

Leaving it as in :)

Post by *windunce »

WHOA! TMI!

Too much information.

But thanks so much for the clarification of those two files.
.bar and .br2

Always wondered why .br2 was so much bigger than .bar.

Clicked your link and read this...
This works only with the 32-bit version of Commander Tool

and I am using the 64 Bit version.

It's not a big deal at all.
For I now realize that it matters not, where or how each users .ini and
.bar/.br2 are 'separated'.

Only that they ARE separated.
So in their current states, there is no possibility of her changing my
buttons and configurations, nor of me messing with hers.

So I am good to go MVV.

Thanks for the quick reply, it's much appreciated.

ps...WHY would TC need plug-ins?????
As is, it performs probably 500 more tasks than I need now! ha ha

Great program...great forum support.

Again THANKS!
Windunce
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

This works only with the 32-bit version of Commander 4.53 and later.
I think this should be read as only with 32-bit version, not 16-bit. Just look onto specified TC version (there were no 64-bit TC until version 8).
So in their current states, there is no possibility of her changing my
buttons and configurations, nor of me messing with hers.
Even with your current configuration it is possible: if your wincmd.ini is in TC dir and her one is in her profile, you can set separate BAR files for each config. But what do you mean by 'storage'? The most correct ways to see which INI files TC uses are Help - About dialog and console set command showing COMMANDER_INI envvar.
Anyway, as I mentioned, you can redirect Buttonbar INI section into profile-specific folder, just add a line into TC config, e.g.:

Code: Select all

[Buttonbar]
RedirectSection=%$LOCAL_APPDATA%\GHISLER\wincmd_bar.ini
(you can redirect any part of TC configuration using RedirectSection and AlternateUserIni keys)
ps...WHY would TC need plug-ins?????
E.g. if you wanna use packers that TC doesn't support natively, or you wanna see extra columns or tooltips with photo/audio/video information like duration, width or height, or if you wanna see more image formats using Lister. Just take a look onto variety of plugins on mentioned site. :)
Phred
Senior Member
Senior Member
Posts: 382
Joined: 2009-06-16, 15:24 UTC
Location: SEAu

Potentially VERY Useful

Post by *Phred »

MVV wrote: ...
Anyway, as I mentioned, you can redirect Buttonbar INI section into profile-specific folder, just add a line into TC config, e.g.:

Code: Select all

[Buttonbar]
RedirectSection=%$LOCAL_APPDATA%\GHISLER\wincmd_bar.ini
(you can redirect any part of TC configuration using RedirectSection and AlternateUserIni keys)
Ahh... it took me half an hour to realise that:
RedirectSection=%$LOCAL_APPDATA%\GHISLER\wincmd_bar.ini
- isn't the default location of the TC ini files for a user.
The default location is under Roaming, not Local, and that string above refers to Local.

I needed C:\Users\Phred\AppData\Roaming\GHISLER\
%$APPDATA%\GHISLER\ is the short version.

But this has led me to understand that I can break the wincmd.ini file up into many component pieces. Fantastic!
I successfully removed the [Colors] section (American spelling) to a file I called TotCmd_Colours.ini

I put AlternateUserIni=1 under the [Configuration] heading of the wincmd.ini file.
And I put RedirectSection=C:\Users\Phred\AppData\Roaming\GHISLER\TotCmd_Colours.ini under the [Colors] heading lower down in the wincmd.ini file.
I copied the [Colors] section to a newly created TotCmd_Colours.ini file.
It worked!

And, interestingly, I discovered a few other things:

1. You can have multiple lines of section settings in an ini file, and TC will obey only the first set. I had two blocks of colour settings and TC ignored the second set, changing and reading only the first. Handy for editing and reverting.

2. You can leave your 'Colors' section untouched, but if you have a
RedirectSection=....
- line anywhere within that section, beginning or end, say, the redirect will be obeyed. Again, handy for editing and reversion.

3. It seems that you could have either AlternateUserIni=1 or AlternateUserIni=0 in the wincmd.ini file, but only if AlternateUserIni=1 existed would any RedirectSection=.... be heeded.
Handy as a switch.

4. I notice that MVV says that you can redirect any part of TC configuration. 'Help' says certain parts cannot be; this may be old news.

5. Unfortunately Help | About doesn't enumerate the multiple ini files.

I'm thinking this feature could be useful because of the MANY edits I have to make each time I set TC up. Apparently tcmd_Setup.exe has defaults written in stone... with no capability to reference a user's preferences.
With segregated inis I might be able to set up my own permanent defaults. More research ahead...
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

The default location is under Roaming, not Local, and that string above refers to Local.
It is a matter of taste. Mentioned folder is used by TC for cache files. I keep my temporary part of wincmd.ini in that folder.
Fantastic!
Yeah! :)
1. You can have multiple lines of section settings in an ini file, and TC will obey only the first set.
You know, INI files have some rules... First section with such name, first parameter with such name...
I notice that MVV says that you can redirect any part of TC configuration
Actually you can use RedirectSection for redirecting any section, even Configuration (except some keys like UseIniInProgramDir) - and it is mentioned in help topic.
Unfortunately Help | About doesn't enumerate the multiple ini files
Why should it enumerate them? It shows root file.
Phred
Senior Member
Senior Member
Posts: 382
Joined: 2009-06-16, 15:24 UTC
Location: SEAu

Post by *Phred »

UPDATE
See below.

MVV wrote:
The default location is under Roaming, not Local, and that string above refers to Local.
It is a matter of taste. Mentioned folder is used by TC for cache files. I keep my temporary part of wincmd.ini in that folder.
Taste it is. I was expecting your reply to refer to the default location, that's all.
MVV wrote:
Fantastic!
Yeah! :)
Sort of. See Update.
MVV wrote:
1. You can have multiple lines of section settings in an ini file, and TC will obey only the first set.
You know, INI files have some rules... First section with such name, first parameter with such name...
Okay.
MVV wrote:
I notice that MVV says that you can redirect any part of TC configuration

Actually you can use RedirectSection for redirecting any section, even Configuration (except some keys like UseIniInProgramDir) - and it is mentioned in help topic.
'Help' needs a fix, then. I'll try what you say.
MVV wrote:
Unfortunately Help | About doesn't enumerate the multiple ini files
Why should it enumerate them? It shows root file.
To be helpful.
Why shouldn't it? TC knows what inis are in use, so why not tell the user? It's not impossible for a user to trace the ini refs, but why not be helpful in the first instance?

UPDATE
I was led by MVV to use the AlternateUserIni and RedirectSection parameters inversely to the way they should be, or the way Help says they should be used, at least.
This alternative ini facility just points to ONE alternative ini file, not multiple 'section' inis as I first thought.

MVV seems to have it wrong when he writes:
RedirectSection=%$LOCAL_APPDATA%\GHISLER\wincmd_bar.ini
Help says this should simply be:
RedirectSection=1 or 0
whereas the companion AlternateUserIni parameter is the reference to a single file, like
AlternateUserIni=%$APPDATA%\GHISLER\wincmd_2.ini

Saying that, however, with further testing, I can't get TC to behave as expected.
Whether a RedirectSection setting (1 or 0) exists or not, adding any AlternateUserIni=...filename... line seems to destroy wincmd.ini totally.
That is, the switching function is faulty.

Summary: adding an AlternativeUserIni line causes a fault.
(Testing as an admin.)

Anyone else seeing this?
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

TOTALCMD.chm section 4.b wrote:RedirectSection=
See description of AlternateUserIni. Note: When placed in the [Configuration] section, all variables of this section will be redirected, except for AlternateUserIni and UseIniInProgramDir, which will always be read from the main ini file.
In AlternateUserIni you specify INI file for default redirection. If you have this key, TC redirects ALL(*) sections into that file, it reads them from that file and it writes new values to that file.

(*) Some sections are not redirected by default but you can force redirection by setting RedirectSection=1 for it. Also you can disable default redirection for specific section using RedirectSection=0 or specify direct redirection path in RedirectSection key for non-default redirection.

I'm using AlternateUserIni to redirect all sections except ones that I need to backup (I've set RedirectSection=0 for them).
Phred
Senior Member
Senior Member
Posts: 382
Joined: 2009-06-16, 15:24 UTC
Location: SEAu

Still trying

Post by *Phred »

As per the opening poster, I'm trying to develop a system that will give me blocks of ini sections that I can use as portable inis for my repeated installations.
There's precious little in the wiki about this RedirectSection and AlternateUserIni facility, so, if we can get this right, it may make the basis of a page.

MVV, questions in my trying to understand:
1. There's ONE AlternateUserIni line that serves for this purpose?
1a. Multiple alternate inis can not be used simultaneously?
2. Most sections are redirected if AlternateUserIni is specified and RedirectSection is switched on (=1)?
3. Except for the two absolutely NON-redirectable keys, all sections CAN BE redirected?
4. Only one reference to an alternative ini file makes sense at any one time?
5. The sections that are required to be redirected may have Redirect...=1, but some may be by default anyway?
5a. The sections that are required to be NOT redirected must have Redirect...=0, but some may be outside the defaults anyway and would not be redirected without Redirect...=1 ?

MVV, can you confirm the correctness of my understanding of this ini set?

WinCmd.ini
[configuration]
AlternateUserIni=somename.ini
RedirectSection=1
item ...
item
item
[section z]
RedirectSection=1
item ...

[section y]
RedirectSection=0
item ...
[section x]
RedirectSection=1
item ...


SomeName.ini
[configuration]
item ...
item
item
[section z]
item ...

[section y]
item ...
[section x]
item ...


With this arrangement, the keys for sections Configuration, Z and X, but not Y, are read from and written to SomeName.ini - WinCmd.ini's same sections being ignored?

Thanks.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

1
Only one (if set).
1a, 4
Multiple AlternateUserIni keys would be ambiguous because AlternateUserIni specifies default redirection file.
3
I haven't tried but it looks so (all except except for AlternateUserIni and UseIniInProgramDir in Configuration section).
5, 5a
If you have set AlternateUserIni, all sections are redirected to that INI (except some special ones and ones with disabled redirection). If you haven't enabled AlternateUserIni, only sections with RedirectSection=Path\To\Ini are reditected.

In your example all sections except section y are redirected so TC will read/write them from/to somename.ini. It is easy to test - just use sections that you can modify and then check (like DirMenu and Confirmation - second one requires RedirectSection=1 to be redirected).
jvh
Member
Member
Posts: 187
Joined: 2007-07-20, 12:28 UTC

Post by *jvh »

Hi,

some time ago I had similar problem - TC settings for multiple users with occasional synchronization of configuration between the PC and laptop. Finally I solved it different way, maybe it will be helpful for you too...

Start_TC.cmd batch file starts Total Commander (TC) and uses / creates ini files for the user automatically.
Ini file names are the format wincmd_<user>.ini and wcx_ftp_<user>.
User ini files are created in (if don't exist) or loaded (if exist) from the folder where is batch file Start_TC.cmd (usually TC's folder). If shortcut is used then in/from folder specified in "Start in:" field.
If ini files for current user don't exist, batch file tries to copy default ones named wincmd_default.ini and wcx_ftp_default.ini from TC's folder.
If wincmd_default.ini doesn't exist a new file "wincmd_<user>.ini" is created with section [Configuration] and values "InstallDir=%TC_PATH%" "Mainmenu=WCMD_ENG.mnu" and "LanguageIni=WCMD_ENG.LNG"
Wcx_ftp_<user>.ini is created automatically by TC when the first access request is made.

Usual location of Start_TC.cmd is in TC's folder - it keeps configuration files in the same folder (portable & sync).
Starting of Start_TC.cmd can be realized through shortcut on the desktop for all users (usually located in "c:\Users\Public\Desktop\" for Win7) or better on startup through shortcut in Start Menu -> Startup (c:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\).

When totalcmd.exe or totalcmd64.exe is started directly you can use default wincmd.ini with AlternateUserIni and RedirectSection - see below. If user ini file exists (wincmd_<user>.ini) then is used, otherwise a new one is created but without defined setting.
Warning: FTP settings cannot be redirected in this case and therefore default wcx_ftp.ini will be used!

Restrictions for starting and closing TC can be done by using parameters in section [Configuration] - Onlyonce=1 (start only one instance of TC per user ), MinimizeOnClose=7 (minimize main window instead of closing it).

P.S.: For user specific buttonbar you can use value "Buttonbar=%COMMANDER_PATH%\Bar\Bar_%USERNAME%.bar in Section [Buttonbar].


Start_TC.cmd

Code: Select all

@ECHO OFF

GOTO :START

---------------------------------------------
Variables setting (change 2 lines below :START):
SET TC_EXE=<totalcmd.exe or totalcmd64.exe> - started version of TC
SET TC_PATH=<Path to file totalcmd.exe or totalcmd64.exe> - e.g.  C:\TotalCmd (without quotes and final backslash)
--------------------------------------------

:START

SET TC_EXE=totalcmd.exe
SET TC_PATH=C:\TotalCmd

SET CUR_DIR=%CD%
SET TC_RUN=%TC_PATH%\%TC_EXE%
IF NOT EXIST "%TC_RUN%" GOTO END

SET TC_INIFILE=%CUR_DIR%\wincmd_%USERNAME%.ini
SET FTP_INIFILE=%CUR_DIR%\wcx_ftp_%USERNAME%.ini

IF NOT EXIST "%TC_INIFILE%" CALL :CREATE_TC_INI
IF NOT EXIST "%FTP_INIFILE%" CALL :CREATE_FTP_INI

start "" "%TC_RUN%" /i="%TC_INIFILE%" /f="%FTP_INIFILE%"

:END
EXIT


:CREATE_TC_INI
  IF EXIST "%TC_PATH%\wincmd_default.ini" (
       copy /B "%TC_PATH%\wincmd_default.ini" "wincmd_%USERNAME%.ini" >NUL
   ) ELSE (
       (ECHO [Configuration] && ECHO InstallDir=%TC_PATH% && ECHO Mainmenu=WCMD_ENG.mnu && ECHO LanguageIni=WCMD_ENG.LNG) > "wincmd_%USERNAME%.ini"
   )
GOTO:eof

:CREATE_FTP_INI
  IF EXIST "%TC_PATH%\wcx_ftp_default.ini" (copy /B "%TC_PATH%\wcx_ftp_default.ini" "wcx_ftp_%USERNAME%.ini" >NUL)
GOTO:eof

Wincmd.ini with redirection to user ini file

Code: Select all

[Configuration]
UseIniInProgramDir=7
AlternateUserIni=wincmd_%USERNAME%.ini
RedirectSection=wincmd_%USERNAME%.ini
[Layout]
RedirectSection=wincmd_%USERNAME%.ini
[Packer]
RedirectSection=wincmd_%USERNAME%.ini
[Confirmation]
RedirectSection=wincmd_%USERNAME%.ini
[Extensions]
RedirectSection=wincmd_%USERNAME%.ini
[Associations]
RedirectSection=wincmd_%USERNAME%.ini
[Shortcuts]
RedirectSection=wincmd_%USERNAME%.ini
[ShortcutsWin]
RedirectSection=wincmd_%USERNAME%.ini
[PackerPlugins]
RedirectSection=wincmd_%USERNAME%.ini
[PackerPlugins64]
RedirectSection=wincmd_%USERNAME%.ini
[FileSystemPlugins]
RedirectSection=wincmd_%USERNAME%.ini
[FileSystemPlugins64]
RedirectSection=wincmd_%USERNAME%.ini
[ListerPlugins]
RedirectSection=wincmd_%USERNAME%.ini
[ListerPlugins64]
RedirectSection=wincmd_%USERNAME%.ini
[ContentPlugins]
RedirectSection=wincmd_%USERNAME%.ini
[ContentPlugins64]
RedirectSection=wincmd_%USERNAME%.ini 
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Instead of all RedirectSection=wincmd_%USERNAME%.ini you could simply write RedirectSection=1 since you have set AlternateUserIni to same INI.
BTW why do you need wincmd.ini with redirection if you call TC with path to INI?
jvh
Member
Member
Posts: 187
Joined: 2007-07-20, 12:28 UTC

Post by *jvh »

MVV wrote:BTW why do you need wincmd.ini with redirection if you call TC with path to INI?
1. UseIniInProgramDir=7
2. When totalcmd.exe or totalcmd64.exe is started directly you can use default wincmd.ini with AlternateUserIni and RedirectSection - see below. If user ini file exists (wincmd_<user>.ini) then is used, otherwise a new one is created but without defined setting.
Warning: FTP settings cannot be redirected in this case and therefore default wcx_ftp.ini will be used!
Post Reply