Hi everyone,

I used to create shortcuts with IWshRuntimeLibrary in C#, but now i am trying to create in java, which i couldn't found via googling.

Can anyone show me the shortcut path of wisdom and illumination? :)

Use the ProcessBuilder class to run the (free) XXMKLINK program?

Thanks James,

Even though, i don't want to use an external executable file to process, i guess this is the best alternative for now (with running in quiet mode "/q")...

try this

String script = "Set sh = CreateObject(\"WScript.Shell\")"
+ "\nSet shortcut = sh.CreateShortcut(\"D:/temp/Shortcut.lnk\")"
+ "\nshortcut.TargetPath = \"D:/some path to file\""
+ "\nshortcut.Save";

File file = new File("d:/temp/temp.vbs");
FileOutputStream fo = new FileOutputStream(file);
//Runtime.getRuntime().exec("wscript.exe D:/temp/crear-acceso-directo.vbs");
Runtime.getRuntime().exec("wscript.exe " + file.getAbsolutePath() );

This article has been dead for over six months. Start a new discussion instead.