用于快捷方式URL的Windows快捷方式(.lnk .url)解析器

时间:2011-02-11 21:17:25

标签: java windows url shortcut

我一直在使用this solution来解析Windows快捷方式并确定快捷方式指向的内容。但是,它仅适用于本地文件和网络共享。 Windows快捷方式也可以指向URL。我一直在使用的解决方案没有正确解析URL快捷方式。知道为什么或如何解决它?

对我来说,它会在此行抛出一个ArrayIndexOutOfBoundsException:

int file_location_info_flag = link[file_start + file_location_info_flag_offset_offset];

我一直在测试一个名为“C:\ googleshort.url”的快捷方式,指向http://www.google.com/。单击快捷方式工作正常并启动谷歌,但java解析器失败。

1 个答案:

答案 0 :(得分:4)

如果您在文本编辑器中打开.url文件,则其中包含以下内容:

[InternetShortcut]
URL=http://stackoverflow.com/questions/4974151/windows-shortcut-lnk-url-parser-for-shortcut-urls

应该很容易解析。

相关问题