03/30/2012 8211 views
We are using Windows 7 and whenever we are downloading a .tiff file from an application it is asking for a file association. Now for this the user has to go to "Open With">"Choose Default program" and choose "Windows Photo Viewer". can this solution be automated and deployed to all of them rather than they doing it. Also, it shows the protected mode prompt, how to diable that?
Answer Summary:
0 Comments   [ + ] Show comments


Community Chosen Answer

Take a look at this article:
Answered 03/30/2012 by: dchristian
Red Belt

All Answers

You can use this Script :
Option Explicit
Dim objShell
set objShell = WScript.CreateObject ("WScript.Shell")

'Change this line to associate your <.abc> to open with
addFileAssociation ".txt", "notepad.exe"

Sub addFileAssociation( fileExt, whichApp )
If ( Left(fileExt, 1) <> "." ) Then
fileExt = "." & fileExt
End If
objShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & fileExt & "\Application", whichApp
End Sub
Answered 03/30/2012 by: akki
Fourth Degree Black Belt

Yes it possible to automate it. I would advise to record the file association type change you want to make with a tool like Install Watch (freeware). After that, you can export the registry changes and deploy it using the method of your choice (wrapped in a .vbs, .bat, .cmd).
Answered 03/30/2012 by: Mencaliss
Senior Purple Belt