Execute a Windows Shortcut (.lnk)Tag(s): IO


A Shortcut is stored in a file with the extension lnk.
// we assume that the .lnk is in the current directory
String currentDir = new File(".").getCanonicalPath();

try {
   Runtime.getRuntime().exec
      ("cmd /c start " + currentDir + "/viewLog.lnk");
}

catch (Exception e){
   JOptionPane.showMessageDialog
      (null, e.getMessage(),"Oups", JOptionPane.ERROR_MESSAGE);
}

blog comments powered by Disqus