Shell open, parameters

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Mar 18, 2010
11
0
#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.
 
Mar 18, 2010
11
0
#3
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
3,376
39
Albuquerque, NM
prospero.unm.edu
#4
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".