开发者

How to get the path of a shortcut (NOT target path) in .net?

I have an .exe application written in vb.net. When I make shortcuts to the application, say on desktop (or anywhere else) and then click on them I want to programatically get the path to that shortcut, ie. C:/Users/xxx/Desktop/shortcut.lnk.

I want this so I can store the开发者_运维技巧 pairs shortcuts : (program + different cmd args).


Your desktop wouldn't be the parent process since it's not a process, I assume explorer or something would be if it's started from a shortcut.

The easiest way to get what you want would be to change the shortcuts to send in some parameter to your app when it starts it. So for example, the shortcut on the desktop could send in the string "desktop". Then you could just pick it up as a normal command line parameter.

If you've declared a Main function as:

Public Shared Sub Main(ByVal args As String())

Then it would appear as one of the strings in the args parameter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜