1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Env vars in tcmd.ini

Discussion in 'Support' started by ccb, May 13, 2011.

  1. ccb

    ccb

    Joined:
    Jul 13, 2009
    Messages:
    44
    Likes Received:
    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....
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,307
    Likes Received:
    39
    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.
     
  3. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,859
    Likes Received:
    83
    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.
     
  4. ccb

    ccb

    Joined:
    Jul 13, 2009
    Messages:
    44
    Likes Received:
    0
    [C:\Program Files\JPSoft\TCMD12x64]
    >ver
    TCC 12.10.65 x64 Windows 7 [Version 6.1.7601]

    When TakeCommand starts, I get the message:
    I have tried %Work, %Work%, and %%Work%%. The env var is set, and is listed when I use 'set' at the command prompt.
     
  5. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    ---- 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
     
  6. ccb

    ccb

    Joined:
    Jul 13, 2009
    Messages:
    44
    Likes Received:
    0
    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.
     
  7. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,859
    Likes Received:
    83
    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.)
     
  8. ccb

    ccb

    Joined:
    Jul 13, 2009
    Messages:
    44
    Likes Received:
    0
    I guess I don't understand what this means:
    [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...
     
  9. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,952
    Likes Received:
    30
    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"?
     
  10. ccb

    ccb

    Joined:
    Jul 13, 2009
    Messages:
    44
    Likes Received:
    0
    [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. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,952
    Likes Received:
    30
    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. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,952
    Likes Received:
    30
    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?
     
  13. ccb

    ccb

    Joined:
    Jul 13, 2009
    Messages:
    44
    Likes Received:
    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]
     

Share This Page