Help - Search - Members - Calendar
Full Version: Registering Extensions/Associations - two methods
MSFN Forums > Unattended Windows Discussion & Support > Application Installs

   
Google Internet Forums Unattended CD/DVD Guide
Dobby
I just did a search for File Extensions and did not get the following page listed in the results:

Registering File Extensions Unattended (Fortunately, I had it in my history so I was able to get the link).

Anyway, I was looking at this post and comparing it with the alternative method:

Gosh's Unattended Tips And Tricks: Trick #3: Associate file types

To me, using the ASSOC command and FTYPE seems to be a cleaner way of doing it than lots of registry stuff.

I'd like to know ppls opinions on this. Is there a prefered method?
prathapml
One thing you have to know, is the "assoc" command will work only for registered programs. So if you already have registered apps, associating the extensions is TEN TIMES easier (and better) to do via assoc.

If you are starting from a situation where you KNOW that your app doesn't already have any entries in the registry, and its YOU who has to do it all, then the .REG method is good.
Dobby
Could you clarify 'registered' program?

As a test I took my favorite editor (EditPlus) and copied it to my Clean VPC install.

I then did the following:

CODE
C:\>ftype editplus=c:\editplus\editplus.exe %1 %*
editplus=c:\editplus\editplus.exe %1 %*

C:\>assoc .txt=editplus
.txt=editplus


I then double-clicked a txt file and viola! it loaded EditPlus with the txt file. Have I missed something? Icons maybe?
prathapml
QUOTE (OriginalSinner @ Jan 26 2005, 04:52 AM)
C:\>ftype editplus=c:\editplus\editplus.exe %1 %*
editplus=c:\editplus\editplus.exe %1 %*
Yep, that was sort of what I meant by "registered".
If you are comfortable with batch-files, it is far easier to do it that way. Dump the .reg way. tongue.gif laugh.gif

Oh, and its a good idea to NOT use absolute paths. Always use system variables. For example,
QUOTE
ftype editplus=c:\editplus\editplus.exe %1 %*   ---->  is not good

ftype editplus=%systemroot%\editplus\editplus.exe %1 %*  ---> is good



Also, if you are able to use this method itself for all associating all your extensions, then announce your findings in the "Registering File Extensions Unattended (REG)" thread. Probably they might be interested to move over to a less-complex method.
SiMoNsAyS
what @prathapml tried to say is that you can't associate the file extension with a value that doesn't exist. that means that program need to be already installed and the value that you associate with the extension HAVE to exist.
Dobby
QUOTE (prathapml @ Jan 25 2005, 05:53 PM)
Oh, and its a good idea to NOT use absolute paths. Always use system variables.

Oh of course it was only an example my scripts never have absolute paths in. Sorry I should follow the rules ALL the time. Call myself a programmer. Pah! Slap those wrists smile.gif
Dobby
Well, thanks guys for the info. I don't see any reason why the extensions can't be applied after the relevant application is installed and personally I think it's a neater way to apply the associations. What's really nice is that these commands by themselves (without any parameters) list all the associations which is much easier to read than the registry.

I'll make any issues I come across known. Thanks again.
sleepnmojo
I used to do the assoc/ftype way of doing things. I've since moved to an inf to add registry keys. Only reason is that it provides much more power in what I can do. Such as changing icons, adding menu extensions for certain file types, etc. If you are JUST looking for a quick and dirty way to associate extensions do the assoc way, but when you need to do more stuff with them, go the registry way.
Dobby
Thanks sleepnmojo that's what I thought. I'll let you know what I decide.
clavicle
I am associting the files using a batch file. Can someone please guide me what is the error in my bat file, because the files with long names (or spaces) do not open, especially in vlc player?

CODE
assoc .dat=VCDMovie  
ftype VCDMovie="%programfiles%\vlc\vlc.exe" %%1 %%*


Like a file "c:\Music\My videos\my saved video.dat" doesn't open in VLC, but a file without name space can be opened.
benners
@clavicle
Try adding quotes around %%1
clavicle
Thanks a lot benners, it worked!
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.