Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

execute file .lnk in Java

i need to execute a .lnk file in java (lnk file that points at an exe file). how can i do?

in vb .net i do

Process.Start(path)

and it works

thx you for help.

like image 334
raf Avatar asked Dec 05 '25 08:12

raf


1 Answers

Use a ProcessBuilder:

ProcessBuilder pb = new ProcessBuilder("cmd", "/c", "C:\\temp\\file.lnk");
Process process = pb.start();

Call process.getInputStream() and process.getErrorStream() to read the output and error output of the process.

like image 170
dogbane Avatar answered Dec 07 '25 20:12

dogbane



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!