你如何在 Java 中创建(和读取)windows 快捷方式(.lnk 文件)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/343776/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do you create (and read) windows shortcut(.lnk file) in Java?
提问by Dennis C
Same question, different langauge.
同样的问题,不同的语言。
How do you do it in Java? Do you use JNI? run exe? or are there any library read/write *.lnk like POI read/write *.xls?
你如何在Java中做到这一点?你使用 JNI 吗?运行exe?或者是否有任何库读/写 *.lnk 像 POI 读/写 *.xls?
I used to workaround to create ".url" which is plain text INI file. But I am looking for other interesting way to do it.
我曾经解决方法来创建“.url”,它是纯文本 INI 文件。但我正在寻找其他有趣的方法来做到这一点。
采纳答案by BraveSirFoobar
I would use a JNI interface if the goal is quality.
如果目标是质量,我会使用 JNI 接口。
http://alumnus.caltech.edu/~jimmc/jshortcut/
http://alumnus.caltech.edu/~jimmc/jshortcut/
For quick hacks, (on my workstation only) : System.Exec() a vbscript :-) (I know, i know).
对于快速破解,(仅在我的工作站上):System.Exec() 一个 vbscript :-)(我知道,我知道)。