Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

trying to auto-invoke a CMD script on TCMD startup

I, along with chatgpt, have beaten my head in trying to get this to work.

Take Command v36 on Windows 11.

I want a desktop/hotkey launcher that:
  1. opens a NEW Take Command GUI instance (not a new tab in an existing instance)
  2. starts maximized
  3. auto-runs a startup command script (a.cmd)
  4. does NOT use /T, because /T reuses the existing TCMD instance as a new tab
Current working launcher:

start "" /max /d "I:\tools\shell\tcmd36" "C:\Program Files\JPSoft\TCMD36\tcmd.exe"

This correctly opens a new TCMD instance/window every time.

However, all attempts to auto-run a.cmd fail unless /T is used, and /T causes unwanted tab reuse.

Attempts that failed:
  • passing "tcc.exe" /K "a.cmd" after tcmd.exe
  • TCSTART
  • TCSTARTPATH
  • /@ini
  • //TCStartPath=...
Question:

What is the correct supported way in v36 to launch a NEW TCMD instance whose initial console automatically executes a startup script, without using /T and without attaching to an existing TCMD window?
 
If you have only one start-up tab and it runs TCC, you could cause the script to run with something like this in TCSTART.BTM. It checks for being the only tab in TCMD and for being an interactive instance. You seem to already have a way of starting new instances of TCMD.

Code:
IFF %_PIPE%%_TRANSIENT%%_IDE% == 0 .and. %_TCTAB == 1 .and. %_TCTABS == 1 THEN
    run the script
ENDIFF

Whose /T are you talking about, TCC's or TCMD's?
 
I confess I haven't actually tested this, but....

I think /@inifile is the one you want. You can use this to start Take Command with a custom .INI file. The custom .INI file will be the same as your regular .INI file, but with an additional section like this:

Code:
[Tab1]
Title=Startup Tab
Command="c:\program files\jpsoft\tcmd36\tcc.exe" /k c:\a.cmd
Directory=c:\
RunAs=
Priority=32
ConPTY=0
Elevated=0
Password=

Modify paths to fit your situation.
 
Last edited:
I confess I haven't actually tested this, but....

I think /@inifile is the one you want. You can use this to start Take Command with a custom .INI file. The custom .INI file will be the same as your regular .INI file, but with an additional section like this:

Code:
[Tab1]
Title=Startup Tab
Command="c:\program files\jpsoft\tcmd36\tcc.exe" /k c:\a.cmd
Directory=c:\
RunAs=
Priority=32
ConPTY=0
Elevated=0
Password=

Modify paths to fit your situation.

Do you not get the default tab (also) if you have Tab1 defined?
 
Back
Top