Page 2 of 2
Posted: 2009-06-06, 18:11 UTC
by HolgerK
jb wrote:But in this case TC is supposed to expand %$PERSONAL% because only TC knows the definition.

You are right.
Notepad++ baffles me because i'd opened the %$PERSONAL%\file.txt before from the expanded path.
But ProcessExplorer revealed that the %$PERSONAL% parameter is not expanded in the command line.
So it's indeed a
bug?
Regards
Holger
Posted: 2009-06-08, 19:43 UTC
by jb
HolgerK wrote:... ProcessExplorer revealed that the %$PERSONAL% parameter is not expanded in the command line.
So it's indeed a bug?
The following example of a toolbar button shows that
it is certainly a bug.
Code: Select all
Command: notepad++.exe "%$PERSONAL%\NppPortable\readme.txt"
Parameters: %$PERSONAL%\NppPortable\license.txt
Start path: %$PERSONAL%\NppPortable
Icon file: %$PERSONAL%\NppPortable\notepad++.exe
Total Commander shows the icons of notepad++.exe and invokes notepad++.exe with the following command line:
Code: Select all
"C:\Dokumente und Einstellungen\jb\Eigene Dateien\NppPortable\notepad++.exe" "C:\Dokumente und Einstellungen\jb\Eigene Dateien\NppPortable\readme.txt" PERSONALNppPortable\license.txt
CONCLUSION: Total Commander expands pseudo environment variables (such as %$PERSONAL%) everywhere
except in the "Parameters:" part.
Posted: 2009-06-09, 00:58 UTC
by Boofo
Shouldn't it be %%$PERSONAL%% when used in the parameter line in TC? I'm using it there and it works fine.
Posted: 2009-06-09, 10:27 UTC
by ghisler(Author)
No, it's not a bug. Environment variables are expanded ONLY in the "Command" field, not in the "Parameters" field. Why? They could collide with internal parameters like %P, %N etc.
Try this instead:
Command: notepad++.exe "%$PERSONAL%\NppPortable\readme.txt" %$PERSONAL%\NppPortable\license.txt
Parameters: (leave field empty)
Posted: 2009-06-09, 13:30 UTC
by jb
Boofo wrote:Shouldn't it be %%$PERSONAL%% when used in the parameter line in TC?
No. See a few posts above
http://ghisler.ch/board/viewtopic.php?p=174109&highlight=#174109
EDIT: Fixed the hyperlink.
Boofo wrote:I'm using it there and it works fine.
Really?
Posted: 2009-06-09, 13:36 UTC
by jb
ghisler(Author) wrote:No, it's not a bug. Environment variables are expanded ONLY in the "Command" field, not in the "Parameters" field. Why? They could collide with internal parameters like %P, %N etc.
What does that mean exactly? Please give me an example of such a collision.
EDIT:
Up to here this thread was mainly about
pseudo environment variables. Therefore I overlooked that you made a more general statement about any type of environment variables. In the meantime I tried to summarize the whole picture in
http://www.ghisler.ch/board/viewtopic.php?p=174418#174418.
Posted: 2009-06-09, 13:37 UTC
by Boofo
Yes, really.
Code: Select all
Command: TOTALCMD.EXE
Parameters: /o /l=%%$PERSONAL%%
Start Path: %COMMANDER_PATH%\
Posted: 2009-06-09, 16:11 UTC
by jb
Boofo wrote:Yes, really.
Code: Select all
Command: TOTALCMD.EXE
Parameters: /o /l=%%$PERSONAL%%
Start Path: %COMMANDER_PATH%\
Nice try.

Posted: 2009-06-09, 16:29 UTC
by Boofo
What do you mean "nice try"? It works. I am using it. There was a big conversation about this a few days back.
http://ghisler.ch/board/viewtopic.php?p=172820#172820
Posted: 2009-06-09, 16:56 UTC
by jb
It works only because the target program is Total Commander itself. No other program knows how to expand %$PERSONAL% (as already explained in the post that I have referenced in my first reply). It's a kind of recursion. So I thought you made a joke.
Posted: 2009-06-09, 17:09 UTC
by Boofo
Ok, I see what you meant. I haven't tried opening anything in My Documents as I don't store anything there. And since TC is all I use, that is why I do it that way. Any documents I would want to open would probably have an association already with it. I will have to play with it now to see what I can come up with.

Posted: 2009-06-09, 18:56 UTC
by jb
ghisler(Author) wrote:Environment variables are expanded ONLY in the "Command" field, not in the "Parameters" field. Why? They could collide with internal parameters like %P, %N etc.
That's not quite correct.
There are
internal parameters (such as %P, %N etc.) and the following types of
environment variables:
1. Normal environment variables (predefined by Windows such as %ProgramFiles% or user-defined)
2. Pseudo environment variables of Total Commander (such as %$PERSONAL%)
Total Commander expands
internal parameters only in the "Parameters" field of buttons and start menu items.
Total Commander expands
environment variables in the following places:
1. "Command" field of buttons and start menu items
2. "Start path" field of buttons and start menu items
3. "Icon file" field of buttons
4. cm_editpath field
5. command line
...?
but NOT in the "Parameters" field because for example %P%N could collide with a normal (user-defined) environment variable %P%.
Pseudo and normal env vars are treated equally although (as far as I understand) internal parameters could not collide with pseudo env vars.
I think environment variables really deserve a chapter in the
online help of Total Commander and hyperlinks in the related chapters, first of all in "
Dialog box: Configuration - Change button bar" and "
Dialog box: Change start menu".