public class WindowsShortcut
Represents a Windows shortcut (typically visible to Java only as a '.lnk' file). https://github.com/codebling/WindowsShortcuts Retrieved 2011-09-23 from http://stackoverflow.com/questions/309495/windows-shortcut-lnk-parser-in-java/672775#672775 Originally called LnkParser Additional information on the format can be found at https://web.archive.org/web/20190625054252/http://www.i2s-lab.com/Papers/The_Windows_Shortcut_File_Format.pdf Written by: (the stack overflow users, obviously!) Dword fix for offsets within file location structure by file extension by JS Lair https://stackoverflow.com/users/10297367/js-lair https://github.com/JSLair Filtering potential links by file extension by JS Lair https://stackoverflow.com/users/10297367/js-lair https://github.com/JSLair "isLocal" bit fix by Naxos84 https://stackoverflow.com/users/3157899/naxos84 https://github.com/Naxos84 Apache Commons VFS dependency removed by crysxd (why were we using that!?) https://github.com/crysxd Headerified, refactored and commented by Code Bling http://stackoverflow.com/users/675721/code-bling Network file support added by Stefan Cordes http://stackoverflow.com/users/81330/stefan-cordes Adapted by Sam Brightman http://stackoverflow.com/users/2492/sam-brightman Support for additional strings (description, relative_path, working_directory, command_line_arguments) added by Max Vollmer https://stackoverflow.com/users/9199167/max-vollmer Based on information in 'The Windows Shortcut File Format' by Jesse Hager <jessehager@iname.com> And somewhat based on code from the book 'Swing Hacks: Tips and Tools for Killer GUIs' by Joshua Marinacci and Chris Adamson ISBN: 0-596-00907-0 http://www.oreilly.com/catalog/swinghks/
Constructor and description |
---|
WindowsShortcut
(File file) |
Type Params | Return Type | Name and description |
---|---|---|
|
public static WindowsShortcut |
from(String path) |
|
public String |
getCommandLineArguments()
|
|
public String |
getDescription()
|
|
public String |
getRealFilename()
|
|
public String |
getRelativePath()
|
|
public String |
getWorkingDirectory()
|
|
public boolean |
isDirectory() Tests if the shortcut points to a directory. |
|
public boolean |
isLocal() Tests if the shortcut points to a local resource. |
|
public static boolean |
isPotentialValidLink(File file) Provides a quick test to see if this could be a valid link ! |
|
public static boolean |
isShortcutFilePath(String path) |
|
public boolean |
isValidShortcut()
|
Tests if the shortcut points to a directory.
Tests if the shortcut points to a local resource.
Provides a quick test to see if this could be a valid link ! If you try to instantiate a new WindowShortcut and the link is not valid, Exceptions may be thrown and Exceptions are extremely slow to generate, therefore any code needing to loop through several files should first check this.
file
- the potential link