Batch file won't run if there is already an instance of TC 17 running

Feb 27, 2015
6
0
Probably another newbie question (to recap I stayed a t Take Command version 8.02.92 for a long time and I have only recently jumped to V17) . I've had the following odd behavior when double clicking a .bat file with windows explorer (Win7 Pro): If there are no instances of TC running, then an instance of TC opens and the batch file runs. All is well with the world. This is the same behavior as under V8. However if there is already a TC v17 window open, and I double click on the batch file from Explorer, what I get is the hourglass which remains until I close the first instance of TC. Then another instance will usually (but not always) open and run the batch file. V8 did not care. I could have one instance of TC open to do something and it would not impact any other instance needed to run a batch file. Is there any setting or way to get that behavior back? Thanks.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,461
88
Albuquerque, NM
prospero.unm.edu
Are you saying that double-clicking on a batch file launches Take Command (the graphical program with all the tabs), or TCC (the console program)? And what kinds of batch files -- .BTM, .BAT, .CMD? It might be helpful to see the associations for those file types.
 
Feb 27, 2015
6
0
Yes, it launches the graphical program with all the tabs. My file associations are:

.bat = Take Command (TCMD.EXE)
.btm = Take Command
.cmd = Take Command

Which are my old TCMD V8 associations carried over. This was all occuring on a .bat file I happend to be working on for an install package. Batch files for my own use are all .btm. Batch files for others running plain vanilla windows (no JPSoft products) are .bat. I don't use .cmd much. I ran a quick test on a .btm file and the behavior seems similar.
 
May 20, 2008
11,401
99
Syracuse, NY, USA
Do you want/expect a second instance of tcmd.exe?

Options ... TakeCommand ... Windows ... uncheck "single instance"
 
Feb 27, 2015
6
0
Thanks. The "single instance" property has never been checked except for once as a test, but it did not matter. Should TCMD.EXE be capable of supporting more than one instance if my file association points to it? Comparing v8 with v17 I see evidence of a paradigm shift. v8 does not have tabs and does not have all the toolbar & menu clutter that v17 has. I've been assuming that the relationship between TCMD and TCC was similar to that of TCMD to 4NT under version 8, but perhaps that was a mistake. Am I attempting to use TCmd.exe in a way that it is no longer suited for? It it more of a gui for TCC now? Should I shift all my file associations over to TCC.EXE?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,461
88
Albuquerque, NM
prospero.unm.edu
"Paradigm shift" is exactly right; it happened with version 9 IIRC. Yes, I would suggest associating batch files with TCC. (Or associating .BTM files with TCC, .BAT and .CMD files with CMD.EXE; many many batches out there on the interwebs do nasty things that cause compatibility issues.)
 
May 20, 2008
11,401
99
Syracuse, NY, USA
In fact, TCMD alone can't even run one instance of the file. TCC runs them. TCMD just shows TCC (perhaps many TCCs) in tabs.

Hmmm! I have 4NTv8 here (8.02.106), but I don't have any GUI EXE in my installation (no TCMD). Should I have one? I have archived a 4nt802.exe with an installer icon. How do I extract the missing EXE from the distribution file?
 
Feb 27, 2015
6
0
"Paradigm shift" is exactly right; it happened with version 9 IIRC. Yes, I would suggest associating batch files with TCC. (Or associating .BTM files with TCC, .BAT and .CMD files with CMD.EXE; many many batches out there on the interwebs do nasty things that cause compatibility issues.)

Thanks. That begins to make sense now. I'll change the file associations and live with it for awhile. Is there a way to run a .btm file and make it open a new tab in the running instance of the TCMD gui instead of opening a new TCC window?
 
May 20, 2008
11,401
99
Syracuse, NY, USA
With TCMD configured for "single instance", from a TCC command line, the following command:

Code:
g:\tc17\tcmd /t g:\tc17\tcc /k v:\avtemp.btm

will either start TCMD (if it's not already running) with the BTM running in the default tab

or (TCMD not already running) open (and switch to) a new tab and run the BTM there.

So I suspect a file association command like the one above, with appropriate paths, and with the BTM's name replaced by "%1" (or something like that) would have the same effect. There are others better qualified than I am to help with file association commands.
 
May 20, 2008
11,401
99
Syracuse, NY, USA
Tested: This works nicely here as the default value in HKEY_CLASSES_ROOT\TCC.Batch\SHELL\OPEN\COMMAND.
Code:
 g:\tc17\tcmd.exe /t g:\tc17\tcc.exe /k "%1" %*
You can't supply parameters (%*) to the BTM when double-clicking on it in Explorer, but you can from the Start\Run box.
You'll need to adjust the paths.
 
Similar threads
Thread starter Title Forum Replies Date
vefatica `Back quotes` - command line vs. batch file Support 5
fpefpe How to? batch file size Support 2
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
P Kill all other instances of tcc from a btm batch file Support 2
fpefpe batch file ending early Support 18
K robocopy cancelling batch file processing Support 28
A Unable to pass batch file arguments unaltered Support 18
MickeyF Why does this batch file give me 'unknown command "else"' error? Support 17
cxxl Set encoding for batch file Support 4
dcantor How to? Batch file to be executed by TCSTART Support 4
D Alias in batch file Support 3
TT's Help! Uninstalling TCC did not restore cmd.exe as Win10 default batch file processor. Support 4
vefatica Exit code of a batch file? Support 4
J cd command altered in batch file Support 3
MickeyF running a program from cmdline versus in batch file Support 1
nickles Fixed Executing long command lines in a batch generates file name errors Support 16
C How to? run a batch file in administrator mode while debugging in take command software Support 1
cgunhouse Fixed bdebugger with not exist batch file causes a crash Support 2
Mezlo menu batch file questions Support 25
F Minimising the command window running from a batch file Support 19
S How to? Batch file problem Support 67
S How to? Incorporate tables from HELP into batch file Support 15
S Fixed TC crashes with a certain batch file Support 6
R How to? debug a nested batch file Support 2
M How to? Save the session log from a batch file? Support 5
S Documentation Topic: Batch File Parameters Support 14
M How to? A very simple question re. the current line number in a batch file... Support 2
Stefano Piccardi IDE unexpectedly exits inside this batch file Support 17
epement Strawberry Perl batch file errors Support 15
B Bdebugger doesn't recognize breakpoint after batch file returns Support 2
E Batch file pauses for no reason Support 16
B Start and keystack do not work in batch file Support 1
B Bdebugger / IDE editor doesn't display called batch file Support 1
M Running a batch file at Windows startup... Support 8
nikbackm Alias - launch external program - batch file Support 16
nickles Using backticks in a batch file Support 8
MBaas GUI-Tool for "File/Open" or tree (for use in batch-files) Support 3
jcalcote Apache Maven startup batch file issues Support 3
deleyd command that launches batch file running TCMD? Support 6
S LOG within a batch file Support 1
vefatica Batch file acts strangely Support 0
D Some feedback on simple batch file Support 2
p.f.moore Equivalent of PRE_EXEC/POST_EXEC in a batch file Support 2
p.f.moore Running another batch file without CALL Support 7
H Configuring the location of BATCH.BCP in the INI file Support 0
fpefpe How to? shortcuts and batch files Support 4
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
R Batch Debugger Command Expansion Window Support 3
K Batch debugger not stepping correctly Support 4

Similar threads