Page 1 of 1

Set Windows File Association

Posted: 17 May 2014 18:50
by binocular222
Example: Assign ext=.jpg to FileType=Image, then assign FileType=Image to ImageEye.exe seems to be an easy task, either via Registry:

Code: Select all

HKEY_CURRENT_USER\SOFTWARE\Classes\.jpg
default=Image

HKEY_CURRENT_USER\SOFTWARE\Classes\Image\Shell\Open\Command
Default="E:\4Media\Image Eye\x32\Image Eye.exe" "%1"
Or via Command promt

Code: Select all

assoc .jpg=Image
ftype Image="E:\4Media\Image Eye\x32\Image Eye.exe" "%1"
However, I got this problem: http://stackoverflow.com/questions/3620 ... ssociation
I have no permission to edit HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice => Everything fail.

Now, anyone has any idea to change file association programmtically?

Re: Set Windows File Association

Posted: 17 May 2014 20:09
by highend
These registry entries are protected (via ACL = access control list).

You have to modify those rights before...

Get SetACL from http://helgeklein.com/setacl/

and use it like this:

Code: Select all

SetACL.exe -on "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" -ot reg -actn clear -clr dacl -silent

Re: Set Windows File Association

Posted: 18 May 2014 08:09
by binocular222
Thanks, I used recursive (-rec yes) to evelate permission for the whole FileExts key :twisted:
run """E:\2System\SetACL\x32\SetACL.exe"" -on ""HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts"" -ot reg -actn clear -clr dacl,sacl -rec yes -log ""E:\2System\SetACL\SetACLreport.txt"" "