开发者

Passing a shortcut to a batch script

My bat script accepts a filepath as a parameter, which allows me to drag-and-drop a开发者_Go百科 file onto it from Explorer. Unfortunately when I drop a shortcut onto it, I simply get the filepath of the .lnk file itself, rather than the file that it refers to. Is there any way to derive the underlying filepath?

I am looking for a native capability in Windows XP that is directly available to bat/cmd without installing or configuring additional software.


Via a batch file it's not possible. If you're looking for native capabilities on Windows, then I'd recommend a VBScript instead. Take a look at this question to see how to interact with the environment via VBScript to get the shortcut file and see it's target.


There's nothing available in Windows batch files (at least through Vista) that will allow you to resolve a shortcut back to it's actual target. That means there is no native capability in WinXP. You might be able to come up with something via PowerShell, but that's not native to either XP or Vista out of the box.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜