Showing results for 
Search instead for 
Did you mean: 

create shortcut to word file

In my code, I am setting my target path to be: 


C:\WINDOWS\system32\java.exe -jar C:\MyApp\MyExe.exe


I am trying to do what I believe is called 'setting a PATH variable', to designate that the program will be running a jar file from java.  When the shortcut is created, the Target Path in the shortcut results in:


"C:\WINDOWS\system32\java.exe -jar C:\MyApp\MyExe.exe"


and WinXP says that it doesn't recognize the path, and the shortcut doesn't work.  If, however, in the shortcut, I remove the leading ", so that it looks like:


C:\WINDOWS\system32\java.exe -jar C:\MyApp\MyExe.exe"


the shortcut will work just fine.


How can I use your method to modify my Target Path in my code so that the resulting Target in the shortcut will be:


C:\WINDOWS\system32\java.exe -jar C:\MyApp\MyExe.exe" or  C:\WINDOWS\system32\java.exe -jar C:\MyApp\MyExe.exe



Thanks for your help.







0 Kudos
Message 11 of 14

You are executing "java.exe" with the arguments "-jar C:\MyApp\MyExe.exe".


Did you try just having C:\WINDOWS\system32\java.exe in the TargetPath

and then adding -jar C:\MyApp\MyExe.exe as the first element in the Arguments array?



To make it work with variations of the windows operating system you should define the target path as %SystemRoot%\system32\java.exe

That way it will find the system path regardless of which drive letter is the system root and if it is C:\Windows or C:\WINNT etc.



Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 12 of 14

Yes.  I had thought of putting C:\WINDOWS\system32\java.exe in the TargetPath and then adding -jar C:\MyApp\MyExe.exe as the first element in the Arguments array right after my recent post, and it seems to work.


I will try using the %SystemRoot%\system32\java.exe as well.


Thank you very much for your help.


0 Kudos
Message 13 of 14

07/26/2021 - kudos to Troy Kujawski
I just used this as I needed a programmatically generated shortcut on my windows 10 desktop.
This method works still!

I used the "Get System Directory" VI to push in the proper windows 10 desktop path for my user into the desktop path and this worked perfectly!


Message 14 of 14