Sign in to follow this  
Followers 0

Script to set file association

1 post in this topic

;Associate extension with command
;version initial
;$extension - self explanative - without dot
;$fileclass   - just a name of file class - purpose of it is to define several extensions of one class
;$description - anything
;$icon         - should be familiar "path\to\some.exe,2' - where 2 is icon number in file
;$command   - command to be executed
;Ex.: fDefineOpenAssociation("mye", "mye_class", "Cool MYE type", @SystemDir & "\SHELL32.dll,1", "myapp.exe %1")
Func fDefineOpenAssociation($extension, $fileclass, $description, $icon, $command)
  RegWrite("HKCR\." & $extension, "", "REG_SZ", $fileclass)

  RegWrite("HKCR\" & $fileclass, "", "REG_SZ", $description);
  RegWrite("HKCR\" & $fileclass & "\DefaultIcon", "", "REG_SZ", $icon)
  RegWrite("HKCR\" & $fileclass & "\shell", "", "REG_SZ", "open")
  RegWrite("HKCR\" & $fileclass & "\shell\open\command", "", "REG_SZ", $command)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0