Link to home
Start Free TrialLog in
Avatar of polasek
polasek

asked on

File associations

I need create file association to run programm associated with this file extension, but I need to give file name without extension as a argument to this programm.
Avatar of lorned
lorned

You need to give more details on what you are trying to do.  What OS are you using?

Lorne
ASKER CERTIFIED SOLUTION
Avatar of cer
cer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What you want is not possible in NT without tools (as far as I know).
Create a shortcut with the explorer or FTYPE to your extension.
Define option OPEN and action "d:\winnt\system32\cmd.exe /c d:\user\x\x.cmd %1"
D:\user\x\x.cmd is only a sample CMD file which does the following:
- extract the name from the full path/name.extension
- start your desired program with name as argument

I have a program CUTEXT.EXE that (nearly) does it. It fails when there is a path before the filename. But I think 4DOS or KIXTART will do:  
   http://www.xs4all.nl/~akhw/winnt.htm
In KIXTART you can use INSTR and SUBSTR to get the name (which is between last "\" and "."

Avatar of polasek

ASKER

Of course The idea of running external file is known. But I prefere solution which uses (e.g.) regular expressions or uses variety of integreted commands of Windows NT, which can be found on every instalation.
I decided to increase point value to 150.
Thank you for your interest to help me solv my problem.
PS to lorned: I'm using Windows NT version 4.0 with service pack 2.0, but I think same situation is on Windows NT 3.5
There are no regular expressions to get only the name without extension. You must use the "external" mode. If you want to use something provided by NT I think there is only QBASIC.
Write a Basic programm that modifies environment variable using the ENVIRON$ command. Be sure to run the program with option /RUN and the last command is SYSTEM.
Use this programm in a batch (see above) and start your final program with the modified var.

I think this is the only way.