Env vars in tcmd.ini

ccb

Jul 13, 2009
47
0
I am trying to share tcmd.ini across two computers. There a few differences between the two that I thought I could account for with environment variables.
For example:
Code:
[Tab3]
Title=
Command="C:\Program Files\JPSoft\TCMD12x64\tcc.exe"
Directory=%Work%\branch\
RunAs=
Password=

However, that doesn't work. Is there some way to configure the starting tabs based on something like environment variables? Starting add'l tcc instances in tcstart (where tcstart can switch on computername)?
Thanks for any suggestions....
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,689
106
Albuquerque, NM
prospero.unm.edu
I am trying to share tcmd.ini across two computers. There a few differences between the two that I thought I could account for with environment variables.
For example:
Code:
[Tab3]
Title=
Command="C:\Program Files\JPSoft\TCMD12x64\tcc.exe"
Directory=%Work%\branch\
RunAs=
Password=

However, that doesn't work.

I just tried that, and it works fine for me. I don't even need the trailing percent sign, which suggests that you can probably use internal variables and even functions in there....

Are you aware that TCC inherits its environment from Take Command, which inherits it from Explorer? You need to set your environment variable before Take Command starts, e.g. through System Properties. And changing system environment variables won't automatically update Take Command's copy of the environment block, unless you have SettingChange=Yes in the [TakeCommand] section of your .INI file. Otherwise, you'll have to restart Take Command to get the changed environment.
 

rconn

Administrator
Staff member
May 14, 2008
12,556
167
However, that doesn't work. Is there some way to configure the starting tabs based on something like environment variables? Starting add'l tcc instances in tcstart (where tcstart can switch on computername)?
Thanks for any suggestions....

You don't say what version you're using. Environment variable support for TCMD.INI was added in v12, so if you're using that it should work. If you're running v11 or earlier, you cannot do it.
 

ccb

Jul 13, 2009
47
0
You don't say what version you're using. Environment variable support for TCMD.INI was added in v12, so if you're using that it should work. If you're running v11 or earlier, you cannot do it.

[C:\Program Files\JPSoft\TCMD12x64]
>ver
TCC 12.10.65 x64 Windows 7 [Version 6.1.7601]

When TakeCommand starts, I get the message:
The directory name is invalid. "%Work\"

I have tried %Work, %Work%, and %%Work%%. The env var is set, and is listed when I use 'set' at the command prompt.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
---- Original Message ----
From: ccb
...
| TCC 12.10.65 x64 Windows 7 [Version 6.1.7601]
...
|
| When TakeCommand starts, I get the message:
|
| Quote:
| The directory name is invalid. "%Work\"
|
| I have tried %Work, %Work%, and %%Work%%. The env var is set, and is
| listed when I use 'set' at the command prompt.

Is the environment variable WORK defined in the registry? You can verify that it is in a stand-alone instance of CMD.EXE (i.e., not in a TCMD tab). Alternately, in TCC you can check that it is in the Windows-provided environment by using the /D, /S, /U and /V options of the SET command - at least one of them will show it.
--
Steve
 

ccb

Jul 13, 2009
47
0
Is the environment variable WORK defined in the registry? You can verify that it is in a stand-alone instance of CMD.EXE (i.e., not in a TCMD tab). Alternately, in TCC you can check that it is in the Windows-provided environment by using the /D, /S, /U and /V options of the SET command - at least one of them will show it.
Thanks for the reply. The env var 'Work' appears in the list from the 'set ' command in cmd.exe, as well as in the list from "set /U" in tcc.exe.
 

rconn

Administrator
Staff member
May 14, 2008
12,556
167
> Thanks for the reply. The env var 'Work' appears in the list from
> the 'set ' command in cmd.exe, as well as in the list from "set /U"
> in tcc.exe.

The variable *must* be in the TCC environment for it to be expanded in the
TCMD.INI. Yours is apparently not, if it's only visable with SET /U.
(Which displays the registry variables, not the actual environment content.)
 

ccb

Jul 13, 2009
47
0
I guess I don't understand what this means:
The variable *must* be in the TCC environment for it to be expanded in the TCMD.INI.

[C:\temp]
>set /s >! env.txt & find "work" env.txt
---------- ENV.TXT
Work=c:\work
[C:\temp]
>set /E >! env.txt & find "work" env.txt
---------- ENV.TXT
CMDLINE=find "work" env.txt
Work=c:\work

Maybe the problem is here, in tmcd.ini:
[Tab1]
Title=
Command="C:\Program Files\JPSoft\TCMD12x64\tcc.exe"
Directory=%Work
RunAs=
Password=

I have tried putting quotes around %Work, as well.

Thanks for the reply...
 
May 20, 2008
12,167
133
Syracuse, NY, USA
On Sat, 14 May 2011 11:45:02 -0400, ccb <> wrote:

|I guess I don't understand what this means:

Start TCC and do "SET" (no options). Do you see the variable "Work"?
 

ccb

Jul 13, 2009
47
0
Start TCC and do "SET" (no options). Do you see the variable "Work"?

[C:\Users\Charles\AppData\Local\Temp]
>ver
TCC 12.10.65 x64 Windows 7 [Version 6.1.7601]
[C:\Users\Charles\AppData\Local\Temp]
>set >! env.txt & find "work" env.txt
---------- ENV.TXT
Work=c:\work
 
May 20, 2008
12,167
133
Syracuse, NY, USA
I guess I can reproduce this. The variable SHRALIAS_SAVE_PATH has been in my system environment for years; I'm confident all apps get it. SET shows it in TCC. When TCC is running in TCMD, it is set in TCC's parent:

v:\> pset %_PPID SHRALIAS_SAVE_PATH
e:\ShrDump\

Using the dialog, I created:
[Tab2]
Title=
Command=d:\tc12\tcc.exe
Directory=%SHRALIAS_SAVE_PATH
RunAs=
Password=

And when I start TCMD I get:

---------------------------
Take Command
---------------------------
The directory name is invalid.
"%SHRALIAS_SAVE_PATH"
---------------------------
OK
---------------------------
 
May 20, 2008
12,167
133
Syracuse, NY, USA
This (The directory name is invalid) also happens in the Tabs\Run dialog if you enter, for example, "%windir\notepad.exe". Are environment variables expected to work there?
 

ccb

Jul 13, 2009
47
0
This appears to work as expected in latest update:
[Tab1]
Title=
Command="C:\Program Files\JPSoft\TCMD12x64\tcc.exe"
Directory=%Work%
RunAs=
Password=

[C:\Program Files\JPSoft\TCMD12x64]
>ver

TCC 12.10.66 x64 Windows 7 [Version 6.1.7601]
 

Similar threads