WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Can WinBatch associate files

Keywords: 	   file associate file associations

Question:

Can WinBatch associate files? Example: If I have a Perl Script File on my machine and I double click on it, NT will pop up the window asking me which application I want to use to open this file. I can then pick PERL.EXE to associate this type of file extension with the Perl.exe.

Can WinBatch do that?

Answer:

Yes.

Sample code from FileMenu...

a="xyz"   ; LOWERCASE extension to associate
Terminate((a=="exe"||a=="com"||a=="bat"||a=="pif"||a=="lnk"),"Ooops","Cannot associate executable files")
b=AskFileName("Associate %a% files with","C:\","Executable Files|*.exe;*.com;*.bat;*.pif|All Files|*.*|","",1)

rkey=RegOpenKey(@REGCLASSES,"")
ErrorMode(@OFF)
RegDeleteKey(rkey,".%a%")
ErrorMode(@CANCEL)
RegSetValue(rkey, ".%a%", "%a%_auto_file")
RegSetValue(rkey,"%a%_auto_file\shell\open\command",strcat('"',b,'" "%%1"'))
AU=StrUpper(a)
RegSetValue(rkey,"%a%_auto_file","%AU% File")
RegClosekey(rkey)

        


Article ID:   W14457
Filename:   Can WinBatch associate files.txt
File Created: 2000:05:04:13:00:30
Last Updated: 2000:05:04:13:00:30