Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Windows cache the contents of .url (Internet Shortcut) files?

I'm implementing a custom URL handler in .NET. To test this, I have created a few different .url files and put them on my Desktop. This generally works fine, but behaves oddly if I change the file's contents, specifically the URL= line. Doing so has no effect — the old URL continues to be opened. Renaming the file, however, works. The file looks like this:

[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,0
[InternetShortcut]
URL=myCustomScheme://some/url/pointing/somewhere
IDList=

All shortcuts I create through New → Shortcut receive the same UUID, so changing that probably won't help.

Is there some internal .url file / URL mapping cache in Windows?

like image 756
Sören Kuklau Avatar asked Jul 25 '10 12:07

Sören Kuklau


People also ask

What are Internet shortcut files?

The Internet shortcut object is used to create desktop shortcuts to Internet sites. Like shortcuts to items in the file system, Internet shortcuts take the form of an icon on the desktop. When the user clicks the icon, the browser is launched and displays the site associated with the shortcut.

What is a .URL file?

A URL file is a shortcut that points to a specific Uniform Resource Locator. When you double-click a URL file, your computer accesses the URL the file contains. URL files most often contain https: web addresses and are used to access web pages. However, URL files can also contain mailto:, tel:, file:, or other URLs.

How do I make an Internet shortcut file?

How to Create a Desktop Shortcut to a Website Using Chrome. To create a desktop shortcut to a website using Google Chrome, go to a website and click the three-dot icon in the top-right corner of your browser window. Then go to More tools > Create shortcut. Finally, name your shortcut and click Create.

How do I associate .URL with Web browser?

Right-click on a . url file and click Open with… Select your browser from the link, and click OK. This method, however, doesn't list every browser installed on the system.


2 Answers

I have a reason to believe that URL files are interpreted by some Internet Explorer component at the time of creation (not biblical). They are only interpreted initially, the first time the file is created. Any modifications to the URL file later on will not be committed. This is because the shortcut is not stored in the file. This is why the file can be modified later on so that it becomes empty, as a 0 byte file and the URL file will appear to be working anyway. The shortcut data is stored in the "Web Document" field as a file property in the NTFS file system. The file merely serves the purpose of pointing to it. You might be able to modify these property fields programmatically, which would supposedly "edit the file". It's a painful exercise just to edit what appears to be a simple text file.

Additionally, once a file name has been used for a URL file, it cannot be reused for new files, no matter what disk or path you save it to. So you have to keep assigning unique file names, never used previously, for each new URL file you create. This has to do with how Internet Explorer caches web content. It remembers what file names have been used already and maps those names to previously defined URL addresses. To reuse a name (or when you run out of ideas for new and unique file names) you have to clear Temporary Internet Files.

Windows 7: %localappdata%\Microsoft\Windows\Temporary Internet Files
Windows 8: %localappdata%\Microsoft\Windows\INetCache

To directly answer your question: yes, it does.

like image 175
Samir Avatar answered Oct 17 '22 08:10

Samir


Windows 7 Caches your Filenames and sometimes, as you said, the filenames in specific locations.

Start regedit and search for the following

HKEY_USERS\S-1-5-21-x-x-x-x\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache

where S-1-5-21-x-x-x-x is your currently logged in User.

There you can see that most (or all?) files have been cached which you have ever accessed.

Maybe you can also deactivate the MUICaching programatically. Maybe this site helps you: Disable Caching

like image 29
syss Avatar answered Oct 17 '22 08:10

syss