Windows 是否缓存 .url(Internet 快捷方式)文件的内容? [英] Does Windows cache the contents of .url (Internet Shortcut) files?

查看:27
本文介绍了Windows 是否缓存 .url(Internet 快捷方式)文件的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 .NET 中实现自定义 URL 处理程序.为了测试这一点,我创建了几个不同的 .url 文件并将它们放在我的桌面上.这通常工作正常,但如果我更改文件的内容,特别是 URL= 行,则行为会很奇怪.这样做没有效果——旧的 URL 会继续打开.但是,重命名文件有效.该文件如下所示:

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=

我通过 New → Shortcut 创建的所有快捷方式都接收相同的 UUID,因此更改它可能无济于事.

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

Windows 中是否有一些内部 .url 文件/URL 映射缓存?

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

推荐答案

我有理由相信 URL 文件在创建时由某些 Internet Explorer 组件解释(非圣经).它们仅在第一次创建文件时被解释.以后对 URL 文件的任何修改都不会提交.这是因为快捷方式未存储在文件中.这就是为什么稍后可以修改该文件以使其变为空的原因,因为 0 字节文件和 URL 文件无论如何似乎都在工作.快捷方式数据作为 NTFS 文件系统中的文件属性存储在Web 文档"字段中.该文件仅用于指向它.您或许能够以编程方式修改这些属性字段,这应该是编辑文件".仅仅编辑一个看似简单的文本文件就是一项痛苦的练习.

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.

此外,一旦文件名用于 URL 文件,就不能再用于新文件,无论您将其保存到哪个磁盘或路径.因此,您必须不断为您创建的每个新 URL 文件分配以前从未使用过的唯一文件名.这与 Internet Explorer 缓存 Web 内容的方式有关.它会记住已经使用过的文件名,并将这些文件名映射到先前定义的 URL 地址.要重复使用名称(或者当您想不出新的唯一文件名时),您必须清除 Internet 临时文件.

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.

这篇关于Windows 是否缓存 .url(Internet 快捷方式)文件的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆