Shell open, parameters

Mar 18, 2010
72
1
I recently had reason to be invoking TCC thusly:
cmd.exe /C "whatever.btm param1 param2"
. (The why is strange and a pain to get around.)

This almost worked, except the parameters to whatever.btm were stripped off. I traced this to how the registry is setup under the association for .btm files, which ends up invoking TCC with a single parameter, the .btm batch file, expressed as [TCC .exe path] "%1" in the btm_auto_file/shell/Read/command anonymous key value.

Taking a look at how .cmd files are run, under cmdfile/shell/open/command, I see "%1" %*, without any mention of cmd.exe, so it appears that the idea of passing parameters in an invocation using the file association mechanism is not some quirky thing I've invented.

Overlooking that this seems to not specify that cmd.exe should execute to interpret a .cmd file, I would like to know if there is a good reason for TCC's setup to not get all the parameters passed to TCC when a .btm is "opened" from a non-TCC program. And more to my immediate problem, how should this be done to make it robust? (or as robust as the OS or its shells permit)

Thanks in advance.
 

rconn

Administrator
Staff member
May 14, 2008
12,556
167
I don't know how you defined the registry settings, but TCC/LE doesn't configure */shell/open/command. There is a batch file (tccbatch.btm) in the installation directory, which it will prompt you to configure the .BTM / .BAT / .CMD handlers, and it definitely *does* specify "%1" %*.
 
Mar 18, 2010
72
1
Thanks, Rex, for your reply.

I had assumed that the installer must have set 'btm_auto_file' as the file type associated with .btm extensions because I never did it, and I found that registry entry on a couple machines, including a laptop I just got in December. That tccbatch.btm looks like a better way to get this right, I suppose. One thing that seems kind of strange is that, to something like cmd.exe, the %* would seem to refer to all the parameters it sees, including the .btm filepath. This would make %1, as propagated by TCC, the same as %0. This made me want to specify "%1" %2* as the arguments to TCC. There must be some subtlety to this escaping my grasp.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,689
106
Albuquerque, NM
prospero.unm.edu
I had assumed that the installer must have set 'btm_auto_file' as the file type associated with .btm extensions because I never did it, and I found that registry entry on a couple machines, including a laptop I just got in December. That tccbatch.btm looks like a better way to get this right, I suppose.

That's Explorer doing that. The installer doesn't create a file association for .BTM files, and TCCBATCH creates a more descriptive name -- I don't remember what it is off the top of my head, but it's more informative than "btm_auto_file".