Env vars in tcmd.ini

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Jul 13, 2009
44
0
#1
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
3,385
39
Albuquerque, NM
prospero.unm.edu
#2
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
10,101
85
#3
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.
 
Jul 13, 2009
44
0
#4
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.
 
#5
---- 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
 
Jul 13, 2009
44
0
#6
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
10,101
85
#7
> 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.)
 
Jul 13, 2009
44
0
#8
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...
 
Jul 13, 2009
44
0
#10
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
 
#11
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
---------------------------
 
#12
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?
 
Jul 13, 2009
44
0
#13
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]