WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Shortcut Information

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Determining the Name of a LNK File that Launched EXE

Keywords: 	 LNK

Question:

Creating, deleting, and changing shortcuts works great, but.... is there any way I get shortcut information of the current shortcut where i start a winbatch executable from. For example, I start Myexe.exe and now I want to display some shortcut information as working dir etc without giving any information where the shortcut is placed.

Answer:

Umm. If I understand your question, you want the EXE to be able to figure out *which* shortcut it was launched from.

I do not think it is possible. Once the exe is launched, then all information about which shortcut launced it is lost.

If you modify your shortcuts, they could pass in some kind of parameter which might help you find them.

A shortcut is run by a call to Shell32.dll, which digs out the information from the shortcut and runs the .exe, .com, .whatever, with the appropriate settings, and, I presume, changing to the appropriate directory. There are no registry settings that will tell you this information, or tell you which shortcut was run. You would have to find a way to poll shell32 calls as they were made in order to determine this information.

Good luck-- it looks like a humongous task. It might be easier to run a script using the searcher extender and create a database of every .lnk file that exists.


Article ID:   W13846
Filename:   Get Shortcut Info of Current Shortcut.txt
File Created: 1999:04:15:16:56:46
Last Updated: 1999:04:15:16:56:46