将快捷方式传递给批处理脚本
我的 bat 脚本接受文件路径作为参数,这允许我从资源管理器将文件拖放到该脚本上。不幸的是,当我将快捷方式放到它上面时,我只是获取 .lnk 文件本身的文件路径,而不是它引用的文件。有什么方法可以导出底层文件路径吗?
我正在寻找 Windows XP 中的本机功能,该功能可直接用于 bat/cmd,而无需安装或配置其他软件。
My bat script accepts a filepath as a parameter, which allows me to drag-and-drop a 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过批处理文件这是不可能的。如果您正在寻找 Windows 上的本机功能,那么我建议您使用 VBScript。查看这个问题,了解如何与环境交互通过 VBScript 获取快捷方式文件并查看其目标。
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.
Windows 批处理文件中没有任何可用的内容(至少在 Vista 中)可以让您将快捷方式解析回其实际目标。这意味着 WinXP 中没有本机功能。您也许可以通过 PowerShell 想出一些东西,但这并不是 XP 或 Vista 原生的。
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.