In Internet Explorer 10 and IE 11 Microsoft has hidden the option to automatically open files rather than prompting for you to open or save a file of that type each time you click on it. In earlier versions of IE, the open/save dialog prompt came with a checkbox option to show, or not to show the dialog again for a particular file type, but this is no longer easily available.
I believe that Microsoft has hidden this option for recent releases of Internet Explorer as a security feature. I agree that this is an important feature to keep your PC safe from aggressive or malicious Web sites, so consider carefully if you really do want to enable automatic downloading of any type of file. The Microsoft developers intentionally do not want files opening themselves by default and this is 99% of the time a good thing. However in some cases you want your users or yourself to have the option to disable the constant prompt to open or save a document from your application.
For example, let’s say you want to serve .rdp files from a Web page to users on your network to be able to terminal into a server. You can see that in such a scenario, the constant prompt to open or save the .rdp file would be annoying to your users. Instead you just want the file to automatically open when they click on the link that you provide. A similar scenario could exist for Excel files or Word documents, just to name a few (in my testing it is not applicable to PDF files).
To solve this problem you can ask your users to manually configure their machines, or you can have them execute a batch file that will make the update for them automatically. I will go through both of these options in the following article, starting with how to manually configure a machine.
Manually Configuring Open/Save for a File Type
- In Internet Explorer 10 or 11 you will first have to click on a file of the type you want to open automatically next time.
- This will give you the Open/Save prompt.
- Select the Save option.
- Then in Internet Explorer click Tools
- Under Tools click the View Downloads option
- You will see a popup containing the file that you just downloaded.
- Right-click on the file
- In the options presented, make sure to un-check the option labeled: Always ask before opening this type of file
From now on if you click on a file of that type, the file will bypass the automatic prompt and will open automatically. This works for me on Windows 7 and Windows 10Â machines running IE 10 and 11. The option does not appear to be supported on Windows 8 running IE 11, and is not supported by the Microsoft Edge browser.
Configuring the Open/Save for a File Type using a Batch File
I have tried several ways of updating a computer’s setting. Bottom line in this case is that this setting requires an update to the Windows Registry. If you made your file type preference changes as described in the manual way of doing things above, then the way that this works is by writing your preference directly to the windows registry.
By the way, if you are not familiar with making registry updates, then you probably shouldn’t be trying this out. You can really mess up your machine by making incorrect registry updates if you aren’t careful.
Steps to Take
So how are we planning to identify and update the correct entry in the Windows Registry? For starters, you’ll need to find out what the key that you need to add is for the file type that you are working with. In this example I’m showing a key that codes for automatically opening .RDP files. However, in your case you will have to specify exactly what file type you want to enable on people’s machines.
The path in the Windows registry where Internet Explorer saves this information is:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\AttachmentExecute\
Changes to this location will update your current user settings. So if you create a batch file for users to run, it will update their personal settings.
Getting the right key that needs to be set is another matter entirely. I was able to get the correct key as follows:
- Open the Registry (type regedit into a command prompt for example)
- Browse to the registry hierarchy (as shown above) and try to browse to the AttachmentExecute key… if it doesn’t exist, then don’t worry… it will be created when you make the file open/save update
- Take note of the keys already in the AttachmentExecute key. You may want to take a before/after screen capture to reference later.
- Close the registry.
- Now open Internet Explorer and go through the steps to manually permit the automatic opening of the file type that you are interested in (as explained earlier in this article)
- Open the Registry again
- Browse to the registry heirarchy and browse to the AttachmentExecute key
- You should now see that a new sub-key has been added.
- In the case of an RDP file this sub-key is: {0002DF01-0000-0000-C000-000000000046}
- The sub-key has a value in it that specifies the file type to permit.
- Again, in the case of an .RDP file the value is a REG-NONE type with the name RDP.File and with data set as 0 (null)
- Again, make sure to see exactly what the system automatically entered for you. This will let you know how to script your batch file
- Write this down to help with the following steps of creating your batch file commands.
Scripting your Batch File
- Create a new batch file (for example: abc.bat)
- Edit the batch file in your favorite editor such as Notepad
- Enter the following lines of code, and then adjust the path and sub-key values based on the notes you took in the steps above.
@ECHO OFF reg query HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\AttachmentExecute\{0002DF01-0000-0000-C000-000000000046} if "%ERRORLEVEL%" EQU "1" ( reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\AttachmentExecute\{0002DF01-0000-0000-C000-000000000046}" /f /v "RDP.File" /t REG_NONE )
The first command queries the path to see if it exists. In this case it queries the full path needed for .RDP files. For other file types such as .PDF files, this path will vary in the unique key number created under AttachmentExecute.
- If the path is not found, the an error level value of 1 will be returned (note… a value of zero means the path was found).
- If an error level of 1 returns for the path, then we need to create a new registry entry to allow documents to be automatically opened.
- Use the Reg add command to create the new registry path and key values.
- As you can see, in this reg add command we add the path of …\AttachmentExecute\{0002DF01-0000-0000-C000-000000000046}
- And we add the key named RDP.FILEÂ with a REG_NONE type and null data
Final Steps
- When you have finished putting together your batch file, save it.
- Then open your registry and delete the key {0002DF01-0000-0000-C000-000000000046} from your registry if it exists.
- Now run the batch file as an administrator
- Open your registry again and make sure that your batch script has properly duplicated creation of the registry key that Internet Explorer automatically made for you in the above steps.
- If the registry entry looks good, then try clicking the link to the file type of your choosing in Internet Explorer. If everything went correctly, then you should no longer be prompted to Open/Save the file… it should open automatically.
If you have trouble with any of the batch file commands, you can always open a DOS command prompt and run the help file for that command. For example for help with the reg add command, type reg add /? and you will see the full list of options. A search engine search can also return helpful results.
Leave a comment