将快捷方式传递给批处理脚本

发布于 2024-08-09 19:00:55 字数 178 浏览 2 评论 0原文

我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

太傻旳人生 2024-08-16 19:00:55

通过批处理文件这是不可能的。如果您正在寻找 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.

情话墙 2024-08-16 19:00:55

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文