0

Does anyone know how to get the paths to shortcuts in Java? So that someone else could download my code and use it without the need of changing the paths in the code. I'm using this to run the executable shortcuts.

public static void main(String[] args) throws Exception {
  ProcessBuilder pb = new ProcessBuilder("cmd", "/c",
                                      "C:\\Users\\...\\Desktop\\notepad.lnk");
  Process p = pb.start();
  p.waitFor();
}

Now I want to find the path of the notepad.lnk with code, and then open it.

khelwood
  • 55,782
  • 14
  • 81
  • 108
Jeremy
  • 1
  • Use an executable jar then all your users need do is to double-click it to start the app – g00se Sep 30 '22 at 11:05
  • It's not clear what you are asking - do you want to find .lnk files or read them to find the actual target? If you mean that you wish to read the target of a Windows shortcut link file, then you can see one of the answers [here](https://stackoverflow.com/questions/309495/windows-shortcut-lnk-parser-in-java). – DuncG Sep 30 '22 at 13:09

0 Answers0