LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Getting target path of Windows shortcuts in Java or batch (https://www.linuxquestions.org/questions/programming-9/getting-target-path-of-windows-shortcuts-in-java-or-batch-612048/)

Slokunshialgo 01-08-2008 01:40 PM

Getting target path of Windows shortcuts in Java or batch
 
At work, we re-image all of the computers for student use from time to time. When we do, we need to test the image to make sure all the programs students might be using work properly. To do so, we have shortcuts to all the needed programs in a single folder, and a Java program that creates a script from these to run each shortcut.

This all works fine, except for one problem: When launching a shortcut in batch, it does not wait until the program closes before it moves on to the next one, so if there are 100 programs in the folder, it tries to open them all at once, which freezes the computer. However, I know that if I call a program directly (ie: C:\Programs\Name.exe) instead of the shortcut (ie: "Example.lnk"), it will wait.

We currently have a pause statement between each one, but my boss wants it changed so we don't have to go back to the command windows every time, but simply close one program, get the next to come up, no waiting, no having to hit a key, etc.

The exact language (Batch script, Java, C++) doesn't matter, but those 3 are ones I actually know how to code in. And although I realize this is a Linux forum, but hopefully somebody here has some idea to help with this. Any help is appreciated.

Looking_Lost 01-12-2008 03:58 PM

Don't know if you've solved it but had a search and the only reasonable answer I could find was this ".lnk files are files which interpreted by the shell, when you execute a symbolic link file from DOS-shell, it finds the actual file to which the link points and executes it. To execute .link file from java simply use cmd /c *.lnk You can not omit cmd /c since Windows CreateProcess call does not know about .lnk files, they are interpreted by DOS shell." http://bugs.sun.com/bugdatabase/view...bug_id=4237760 Don't know if it's still valid. Plus a few about using filesystem view and other about parsing the lnk to extract the info , none that I can try out as (you've guessed, don't have windows handy)


All times are GMT -5. The time now is 06:35 AM.