Restart a batch file started in cmd in TCC(LE)

Oct 29, 2008
83
0
#1
Start your batch file with the following, adjusting the TCC path to your system or defining an environment variable and using that instead. This fragment preserves any exit code set by a “quit #” statement.

Usage examples are svn hooks or Retrospect Backup event handler scripts, which explicitly look for .bat files and start them with cmd.exe.

On my systems, I symlink or junction “C:\Program Files\JPSoft\TCMD” or “C:\Program Files\JPSoft\TCCLE” to the current version, so any batch files don’t need to be adjusted every time I upgrade.
Code:
@echo off
if 01 == 1 goto tccstarthere
"C:\Program Files\JPSoft\TCMD\tcc.exe" /c %0 %*
exit /b %errorlevel%
:tccstarthere
 
May 12, 2014
18
0
Kansas
#2
Why not just change the file extension to .btm? Running tccbatch.btm as an Administrator will set the proper file association.
 
Oct 29, 2008
83
0
#3
Sometimes you don't have control over the extension or the command processor. The backup client will only run RetroEventHandler.bat, not RetroEventHandler.btm. Svnserve includes .bat in its extension search list but not .btm, and explicitly starts the .bat with cmd.
 
Aug 23, 2010
186
2
#4
You're comparing apples and oranges. "retro processor" will run RetroEventHandler.bat ? That's fine.
Call your RetroEventHandler.btm from it.
I hope, setting a file association is not outside of your control?
But for the love of God, do NOT name your scripts ".cmd", or even worse, ".bat", if they are not supposed to be run with CMD.EXE. Or COMMAND.COM.