Welcome!

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

SignUp Now!

File association: System cannot find the associated program

Oct
18
0
Hello,

I cannot run the file "X.pox" simply typing it on the [TCC] command line - I'm getting error message:

Code:
C:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>X.pox
TCC: (Sys) System cannot find the specified file.
 "C:\Lukas\Bat\PoX.bat %1 --restart"

(NB: Maybe a slightly different message than "System cannot find the specified file" appears - I'm getting the message in Czech, so that's translation, what you would probably get on an en/us machine.)

Also, some checks:

Code:
C:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>assoc .pox
.pox=Po.X.File

C:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>ftype pox_auto_file
pox_auto_file="C:\Lukas\Bat\PoX.bat" "%1" --restart

C:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>which x.pox
x.pox is associated with : C:\Lukas\Bat\PoX.bat %1 --restart

- It seems the problem is that TCC takes the whole associated string as the command/executable name whilst just the first part (until the first space character out-of-quotes) is the name of the executable, the rest are parameters (and, of course, %1 to be replaced by the file name, X.pox, etc.).

In this situation, I must run cmd.exe which handles file extension association properly - but what to do TCC to handle this as well?

TIA.

LuP
 
Tell TCC to emulate CMD (bugs) compatibility / it's a directive

: In this situation, I must run cmd.exe which handles file extension association properly
- but what to do
: TCC to handle this as well?
 
Tell TCC to emulate CMD (bugs) compatibility / it's a directive

How exactly / which directive?

Does it mean to start the TCC with an additional parameter?

Or to call (= type to the TCC command line) something else than just "X.pox"?

Or...?
 
You might consider using executable extensions.

set .pox=C:\Lukas\Bat\PoX.bat --restart

The above assumes that the --restart
switch can come before the file name on your command line. If not,
then you either can't use it or you need to change your command line parsing
in PoX.bat.

Also, pox_auto_file is not the same
ftype as Po.X.File. While they may contain the same values, they
are different entries in the registry.

-Scott




Hello,

I cannot run the file "X.pox" simply typing it on the [TCC] command
line - I'm getting error message:

Code:
C:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>X.pox
TCC: (Sys) System cannot find the specified file.
"C:\Lukas\Bat\PoX.bat %1 --restart"
(NB: Maybe a slightly different message
than "System cannot find the specified file" appears - I'm getting
the message in Czech, so that's translation, what you would probably get
on an en/us machine.)

Also, some checks:

Code:
C:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>assoc
.pox
.pox=Po.X.File

C:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>ftype pox_auto_file
pox_auto_file="C:\Lukas\Bat\PoX.bat" "%1" --restart

C:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>which x.pox
x.pox is associated with : C:\Lukas\Bat\PoX.bat %1 --restart
- It seems the problem is that TCC takes
the whole associated string as the command/executable name whilst just
the first part (until the first space character out-of-quotes) is the name
of the executable, the rest are parameters (and, of course, %1 to be replaced
by the file name, X.pox, etc.).

In this situation, I must run cmd.exe which handles file extension association
properly - but what to do TCC to handle this as well?

TIA.

LuP
 
You might consider using executable extensions.

set .pox=C:\Lukas\Bat\PoX.bat --restart

OK, that's a nice feature.

The above assumes that the --restart
switch can come before the file name on your command line. If not,
then you either can't use it or you need to change your command line parsing
in PoX.bat.

Hmm, it can be used in this case, but what if an .exe was associated with the file extension?

I mean e.g.
Code:
pox_auto_file="C:\Lukas\Bat\PoX.[B]exe[/B]" "%1" --restart
instead of
Code:
pox_auto_file="C:\Lukas\Bat\PoX.bat" "%1" --restart

Cmd.exe handles this case by default, TCC does not?

- Is this the feature/limitation of TCC?

(Nice to know about the "set .ext=..." trick, but it requires some more workarounds...).

Also, pox_auto_file is not the same
ftype as Po.X.File. While they may contain the same values, they
are different entries in the registry.

Yes, I know that - some registry mess, but this should not affect the problem reported.

LuP
 
: ---Quote---
: Tell TCC to emulate CMD (bugs) compatibility / it's a directive
: ---End Quote---
: How exactly / which directive?
:
: Does it mean to start the TCC with an additional parameter?
:
: Or to call (= type to the TCC command line) something else than just "X.pox"?
:
: Or...?

I am not sure of the exact wording as my trial v13 ran out..
Configure tcc / tc
Another menu appears "options" I think, look for emulate CMD

TCC/TC will then emulate the bugs CMD has while still being thousands times smarter.

I really should invest in v13 as I am being left behind and just really taking a wild
guess at what you want
Sorry if I appear to be wasting your time

Regards
 
Type "Option" from a TCC prompt
or select "Configure TCC..." from the Options menu in Take Command.

On the "Startup" tab, select
"Duplicate CMD.EXE bugs", click OK, then restart TCC for the
changes to take effect.

-Scott



: ---Quote---
: Tell TCC to emulate CMD (bugs) compatibility / it's a directive
: ---End Quote---
: How exactly / which directive?
:
: Does it mean to start the TCC with an additional parameter?
:
: Or to call (= type to the TCC command line) something else than just
"X.pox"?
:
: Or...?

I am not sure of the exact wording as my trial v13 ran out..
Configure tcc / tc
Another menu appears "options" I think, look for emulate CMD


TCC/TC will then emulate the bugs CMD has while still being thousands times
smarter.

I really should invest in v13 as I am being left behind and just really
taking a wild
guess at what you want
Sorry if I appear to be wasting your time

Regards
 
On Thu, 13 Oct 2011 04:16:33 -0400, LuP <> wrote:

Code:
---------
C:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>assoc .pox
.pox=Po.X.File

C:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>ftype pox_auto_file
pox_auto_file="C:\Lukas\Bat\PoX.bat" "%1" --restart

C:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>which x.pox
x.pox is associated with : C:\Lukas\Bat\PoX.bat %1 --restart
---------

Where did "pox_auto_file" come from?

What about

Code:
ftype Po.X.File
 
On Thu, 13 Oct 2011 10:57:00 -0400, samintz <> wrote:

|Type "Option" from a TCC prompt
|or select "Configure TCC..." from the Options menu in Take Command.
|
|On the "Startup" tab, select
|"Duplicate CMD.EXE bugs", click OK, then restart TCC for the
|changes to take effect.

I don't know if this is accurate, but the help says:

"Duplicate CMD bugs : Tells the TCC parser to duplicate bugs in CMD. The only
bug currently replicated is in the IF command."

If it's not accurate, I'd like to know all that option does.
 
On Thu, 13 Oct 2011 04:16:33 -0400, LuP <> wrote:
Where did "pox_auto_file" come from?

What about

Code:
ftype Po.X.File

"pox_auto_file" was automatically created by Windows as soon as a new extension (.pox) was associated with a program (D:\Lukas\Bat\PoX.bat).

"Po.X.File" was added to the registry later, when the processing application (which is called from the PoX.bat) added a description to the .pox file type.

Anyway - I tried the following test ("a new extension from scratch"):

  1. Create a new (empty) file with a non-registered extension, e.g. "t.ttt".
  2. Create a new batch file (to be associated with .ttt extension) "ttt.bat" which will do "nothing", e.g. to contain just "echo %1 %2".
  3. Run the t.ttt from the Windows explorer - it must ask you for a program to associate - select the "ttt.bat".
  4. In this moment, new entries in the registry should appear:
    • HKCR\.ttt=ttt_auto_file
    • HKCR\ttt_auto_file\shell\open\command="D:\Lukas\Bat\ttt.bat" "%1"
    • HKCR\Applications\ttt.bat\shell\open\command="D:\Lukas\Bat\ttt.bat" "%1"
  5. Now, when I type "t.ttt" to the TCC command prompt, I get an error message:
    Code:
    [D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics]t.ttt
    TCC: (Sys) Systém nemůže nalézt uvedený soubor. (Means: ~File not found.)
     "D:\Lukas\Bat\ttt.bat %1"
    I.e. the same kind of error as before.
Could you please confirm the same behaviour?

- If so, is there a way how to make TCC work "as expected" (compared with cmd.exe) even in this case (an extension associated manually / an extension associated with a batch file rather than an executable / command of the form "path-to-exe" "%1" --an-optional-parameter)?

(NB: The cmd.exe gives:
Code:
D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>t.ttt

D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>echo "D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics\t.ttt"
"D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics\t.ttt"
)

LuP
 
Can you please try creating a new association with TakeCommand's ASSOC and FTYPE commands? Is it working then?
Code:
ASSOC .newext=newext_mine
FTYPE newext_mine=C:\Windows\system32\notepad.exe "%%1"
>junk.newext
junk.newext
It works for me (opens notepad with junk.newext in it).
 
From: Stefano Piccardi
| Can you please try creating a new association with TakeCommand's
| ASSOC and FTYPE commands? Is it working then?
| ...
| It works for me (opens notepad with junk.newext in it).

The OP tried to run a .BAT file through the ASSOC and FTYPE registry entries of the special extension, not an executable program, which would still point to another level of indirection requiring the loading of a command processor.

BTW, I don't understand why some TCMD/TCC/TCCLE users insist on using the .BAT or the .CMD extensions instead of the .BTM extension, thus slowing down the command processor, requiring it to open the batch file for each command, read the command, close the file, parse and execute the command, instead of reading "Batch To Memory" once.
--
Steve
 
Can you please try creating a new association with TakeCommand's ASSOC and FTYPE commands? Is it working then?
Code:
ASSOC .newext=newext_mine
FTYPE newext_mine=C:\Windows\system32\notepad.exe "%%1"
>junk.newext
junk.newext
It works for me (opens notepad with junk.newext in it).

No, it doesn't work for me:

Code:
TCC LE  13.00.23   Windows XP [Version 5.1.2600]
Copyright 2011 JP Software Inc.  All Rights Reserved

D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>assoc .newext=newext_mine

D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>FTYPE newext_mine=C:\Windows\system32\notepad.exe "%%1"

D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>junk.newext
TCC: Unknown command "junk.newext"

D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>

And:

Code:
D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>assoc .txt
.txt=txtfile

D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>ftype txtfile
txtfile=C:\WINDOWS\system32\NOTEPAD.EXE %1

D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>t.txt
TCC: Unknown command "t.txt"

D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>

??

LuP
 
BTW, I don't understand why some TCMD/TCC/TCCLE users insist on using the .BAT or the .CMD extensions instead of the .BTM extension, thus slowing down the command processor, requiring it to open the batch file for each command, read the command, close the file, parse and execute the command, instead of reading "Batch To Memory" once.
--
Steve

BTW:

No problem with using .btm files under TC/TCC/TCCLE in the future. (Thanks for the explanation: BTM = Batch To Memory.)

I'm used to use cmd.exe & .bat files so far; so if I move to another command processor (TC*), I need to keep functionality of launching programs/batches.

It's important for me to be able still to just type "t.ttt" and the processor will launch the associated program or .bat file; like as the command processor was cmd.exe.

I have no problem with creating .btm files which will be targeted just for TC*.

But I need .bat files to be safely launchable under both TC* and cmd.exe.

LuP
 
User-level file associations? (If you're using v13, you can use ASSOC /U and FTYPE /U to display or change these.)
 
No, it doesn't work for me:

Code:
D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>assoc .newext=newext_mine

D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>FTYPE newext_mine=C:\Windows\system32\notepad.exe "%%1"

D:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics>junk.newext
TCC: Unknown command "junk.newext"
Did you create file junk.newext after FTYPE? (third line in the code block of my post)
 
> - If so, is there a way how to make TCC work "as expected" (compared
> with cmd.exe) even in this case (an extension associated manually / an
> extension associated with a batch file rather than an executable /
> command of the form "path-to-exe" "%1" --an-optional-parameter)?

TCC does not support using a batch file for a file association. (I've
*never* seen anyone do that before!)

The TCC command parser has already determined that you're not running an
internal command or batch file. It can't then rewind itself after it
discovers you really are trying to run a batch file, so it just terminates
the line parsing with an error. Changing the parser to support this syntax
would require some major rewriting, and thus only conceivable in a major
update, not a minor revision.
 
Did you create file junk.newext after FTYPE? (third line in the code block of my post)

No...

Having "junk.newext" created after FTYPE, your way works [in this case]:

Code:
TCC LE  13.00.23   Windows XP [Version 5.1.2600]
Copyright 2011 JP Software Inc.  All Rights Reserved

C:\Lukas\Bat>assoc .newext=newext_mine

C:\Lukas\Bat>FTYPE newext_mine=C:\Windows\system32\notepad.exe "%%1"

C:\Lukas\Bat>junk.newext

C:\Lukas\Bat>

As soon as I use a .bat instead of an .exe, I got the error:

Code:
C:\Lukas>assoc .newext=newext_mine

C:\Lukas>FTYPE newext_mine="c:\Lukas\Bat\newext.bat" "%%1"

C:\Lukas>c:\Lukas\Jobs\Pristpo.PDPS\SO_201\Statics\junk.newext
TCC: (Sys) Systém nemůže nalézt uvedený soubor.
 "c:\Lukas\Bat\newext.bat %1"

C:\Lukas>

LuP
 
TCC does not support using a batch file for a file association. (I've
*never* seen anyone do that before!)

Running .bat instead of .exe is very common in our company, e.g.:

  • .pog -> PoG.bat: run app for geometrical calculations
  • .pob -> PoB.bat: run app for dimesioning reinforced beams
  • other .po? -> Po?.bat: similar apps
  • .tex, .ltx -> pdfLaTeX.bat (the batch file e.g. looks for some special files and if it finds them, it e.g. runs an older version of LaTeX)
  • .mkiv, .ctx -> ConTeXt.bat - build .pdf from another TeX-like source
  • .bpdf -> BuildPdf.bat - run a pdf builder
  • .gp -> GP.plot - run gnuplot with some pre-settings
  • ...

The TCC command parser has already determined that you're not running an
internal command or batch file. It can't then rewind itself after it
discovers you really are trying to run a batch file, so it just terminates
the line parsing with an error. Changing the parser to support this syntax
would require some major rewriting, and thus only conceivable in a major
update, not a minor revision.

OK - this is information of importance - will the TC support associating an [old style] .bat file with a file name, though in the next version?

- I'm just using TC* for testing (but thinking about to buy a advanced non-free version; Christmas present); and this kind of functionality is important [at least for me].

LuP
 
On Fri, 14 Oct 2011 02:59:45 -0400, LuP <> wrote:

|Running .bat instead of .exe is very common in our company, e.g.:
|
|* .pog -> PoG.bat: run app for geometrical calculations
|* .pob -> PoB.bat: run app for dimesioning reinforced beams
|* other .po? -> Po?.bat: similar apps
|* .tex, .ltx -> pdfLaTeX.bat (the batch file e.g. looks for some special files and if it finds them, it e.g. runs an older version of LaTeX)
|* .mkiv, .ctx -> ConTeXt.bat - build .pdf from another TeXt-like source
|* .bpdf -> BuildPdf.bat - run a pdf builder
|* .gp -> GP.plot - run gnuplot with some pre-settings
|* ...

Wouldn't be quite easy to write an EXE (to be used in the associations) that
would launch TCC (or your favorite command processor) and an appropriate script
to handle each file extension? The collection of extensions, each with a
command processor, script name, and arguments could exist in a database; the EXE
could be completely generic. You could use TCC, CMD, Perl ... whatever.

Alternatively, if TCC is all you need, make each association something like

(path\)TCC.EXE (/c) batchfile (args) "%1"
 
Running .bat instead of .exe is very common in our company.
If, as it's likely, you don't want to rewrite your batch files, then Scott's suggestion is the way to go, and it will work on TCCLE
samintz said:
You might consider using executable extensions.

set .pox=C:\Lukas\Bat\PoX.bat --restart

The above assumes that the --restart
switch can come before the file name on your command line. If not,
then you either can't use it or you need to change your command line parsing
in PoX.bat.
If instead you'd consider extending your batch files, there are many ways to accomplish your goal, for instance, you could prefix affected command lines with an alias that rearranges line elements as needed, runs the appropriate batch file, etc.
Code:
rem SAFECHARS plugin needed; untested on TCCLE

C:\temp>echo on
echo on

C:\temp>assoc .ttt=do_ttt
assoc .ttt=do_ttt

C:\temp>ftype do_ttt=C:\bats\mybat.bat %%1 --args
ftype do_ttt=C:\bats\mybat.bat %1 --args

C:\temp>alias callbat=`call %@replace[%[_PCT]1,%1,%@SAFEEXP[@ftype[%@assoc[.%@ext[%1]]]]] %2$`
alias callbat=`call %@replace[%[_PCT]1,%1,%@SAFEEXP[@ftype[%@assoc[.%@ext[%1]]]]] %2$`

C:\temp>callbat d:\data\file.ttt
call C:\bats\mybat.bat d:\data\file.ttt --args
TCC: Unknown command "C:\bats\mybat.bat"

C:\temp>
I'm just using TC* for testing (but thinking about to buy a advanced non-free version; Christmas present); and this kind of functionality is important [at least for me].
I think Rex still offers 10 life-time licenses for translations of the product. Ask him, if you're interested.
 
Ad Scotts' suggestion (1):

I have "Duplicate CMD.EXE bugs" on all the time; so reported problems occurred with "Duplicate CMD.EXE bugs" on.

Ad Scotts' suggestion (2):

It requires to collect file extensions that will need to be reset for TC* session; - all extensions that call a .bat instead of .exe.

- May be useful; practical testing can show; anyway, it requires some more work than just to replace cmd.exe with TC*.exe.

If, as it's likely, you don't want to rewrite your batch files, then Scott's suggestion is the way to go, and it will work on TCCLE

If instead you'd consider extending your batch files, there are many ways to accomplish your goal, for instance, you could prefix affected command lines with an alias that rearranges line elements as needed, runs the appropriate batch file, etc.
Code:
rem SAFECHARS plugin needed; untested on TCCLE

C:\temp>echo on
echo on

C:\temp>assoc .ttt=do_ttt
assoc .ttt=do_ttt

C:\temp>ftype do_ttt=C:\bats\mybat.bat %%1 --args
ftype do_ttt=C:\bats\mybat.bat %1 --args

C:\temp>alias callbat=`call %@replace[%[_PCT]1,%1,%@SAFEEXP[@ftype[%@assoc[.%@ext[%1]]]]] %2$`
alias callbat=`call %@replace[%[_PCT]1,%1,%@SAFEEXP[@ftype[%@assoc[.%@ext[%1]]]]] %2$`

C:\temp>callbat d:\data\file.ttt
call C:\bats\mybat.bat d:\data\file.ttt --args
TCC: Unknown command "C:\bats\mybat.bat"

C:\temp>

So it seems that the "file.ttt" will have to be run by "callbat file.ttt" (?) (more typing tan just "file.ttt" to the command line).

LuP
 
> Running .bat instead of .exe is very common in our company, e.g.:

You can do this by creating an executable extension (the easiest solution),
or you can change the association to do a "tcc.exe /c batchname ..." (or
"cmd.exe /c batchname ...").


> OK - this is information of importance - will the TC support associating
> an [old style] .bat file with a file name, though in the next version?

If enough users want it. Click on the Feedback tab and add it to the
suggestion list.
 
I figured the issue was something like
that so I was successful in getting it to work by doing the following:

assoc .pox=poxfile
ftype poxfile=c:\tc13\tcc.exe /c c:\temp\pox.bat
%%1 --restart

and my pox.bat file contains:
echo %*
pause

then when I run foo.pox it works correctly.

-Scott

rconn <> wrote on 10/14/2011
01:27:46 AM:


>
> Quote:
>
> > - If so, is there a way how to make TCC work "as expected"
(compared

> > with cmd.exe) even in this case (an extension associated manually
/ an

> > extension associated with a batch file rather than an executable
/

> > command of the form "path-to-exe" "%1" --an-optional-parameter)?


>
> TCC does not support using a batch file for a file association. (I've
> *never* seen anyone do that before!)
>
> The TCC command parser has already determined that you're not running
an

> internal command or batch file. It can't then rewind itself after
it

> discovers you really are trying to run a batch file, so it just terminates
> the line parsing with an error. Changing the parser to support this
syntax

> would require some major rewriting, and thus only conceivable in a
major

> update, not a minor revision.
>
>
 
You can do this by creating an executable extension (the easiest solution), or you can change the association to do a "tcc.exe /c batchname ..." (or "cmd.exe /c batchname ...")
Or, to revive an ages-old argument, you can simply leave .BAT files to be executed by CMD.EXE and use .BTM for Take Command
 
I figured the issue was something like
that so I was successful in getting it to work by doing the following:

assoc .pox=poxfile
ftype poxfile=c:\tc13\tcc.exe /c c:\temp\pox.bat
%%1 --restart

and my pox.bat file contains:
echo %*
pause

then when I run foo.pox it works correctly.

-Scott

Yes.

In general - possible, but not so handy - you must
  • re-associate each extension associated with .bat file type,
  • - or at least each extension you suppose to use in TC* prompt,
  • create a startup file to provide this above.

LuP
 
Or, to revive an ages-old argument, you can simply leave .BAT files to be executed by CMD.EXE and use .BTM for Take Command

Yes, this could be elegant - just re-associate the .bat extension with cmd.exe.

BTW: The cmd.exe gives:

Code:
D:\Lukas>assoc .bat
.bat=batfile

D:\Lukas>ftype batfile
batfile="%1" %*

D:\Lukas>

LuP
 
Code:
D:\Lukas>assoc .bat
.bat=batfile

D:\Lukas>ftype batfile
batfile="%1" %*
Does anyone know what the %* really is for? I thought that it's the command-line - and not the registry - that passes arguments on to cmd.exe.
 
Does anyone know what the %* really is for?

I know just what "cmd.exe" and "call /?" gives;
I would have to translate the whole output so it seems better for you to try it;
cmd.exe tells that "%*" refers to all arguments, i.e. "%1 %2 %3 %4 %5...".

(So "%1" gets doubled? - "%1" %* -> "%1" %1 %2 %3...?)

LuP
 
Ftypes and assoc's are saved in the registry. So it would be once and done. It's not something you would have to add to a startup file.

-Scott


======================
Quote:


Originally Posted by samintz
I figured the issue was something like
that so I was successful in getting it to work by doing the following:

assoc .pox=poxfile
ftype poxfile=c:\tc13\tcc.exe /c c:\temp\pox.bat
%%1 --restart

and my pox.bat file contains:
echo %*
pause

then when I run foo.pox it works correctly.

-Scott

Yes.

In general - possible, but not so handy - you must
* re-associate each extension associated with .bat file type,
* - or at least each extension you suppose to use in TC* prompt,
* create a startup file to provide this above.


LuP
 

Similar threads

Back
Top