将 VBS 脚本分配给键盘快捷键 [英] Assign VBS Script to a Keyboard Shortcut

查看:69
本文介绍了将 VBS 脚本分配给键盘快捷键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常基本的 VBS 脚本,我计划在我的 Windows 7 机器上经常使用它.有什么方法可以将它绑定到键盘快捷键,这样我就不必讨厌地通过资源管理器导航到它.

I have a very basic VBS script that I plan on using frequently on my Windows 7 machine. Is there any way I can bind it to a keyboard shortcut so I don't have to navigate to it through Explorer obnoxiously.

我意识到这个问题与编程甚至脚本编写无关,但我无法在网上或通过我自己的实验找到直接答案.我确信某处有一个简单的解决方案......

I realize this question does not directly pertain to programming, or even scripting for that matter, but I could not find a straight answer online or through my own experimentation. I'm sure that there is a simple solution somewhere...

感谢您抽出宝贵时间阅读,并希望回复我的询问.埃文·乌古尔.

Thank you for taking the time to read, and hopefully respond to my inquiry. Evin Ugur.

推荐答案

Windows 确实内置了对 shell 快捷键的支持,其中按键用于调用启动的 *.lnk 文件您的 VBScript(使用 cscript 或 wscript).

Windows does have built-in support for shell shortcut keys, where a keypress is used to invoke an *.lnk file that launches your VBScript (using either cscript or wscript).

创建一个快捷方式文件,让它直接调用您的 VBScript 文件或使用适当的参数运行 cscript 或 wscript,然后保存并打开其属性表并在快捷键"中设置击键.字段(我建议类似 Ctrl+Alt+K).

Create a shortcut file, have it invoke your VBScript file directly or run cscript or wscript with the appropriate arguments, then save it and open its Properties sheet and set a keystroke in the "Shortcut key" field (I suggest something like Ctrl+Alt+K).

像这样:

然后,每当您按 Ctrl+Alt+K 时,无论活动的应用程序如何,都会调用您的脚本.

Then, whenever you press Ctrl+Alt+K, regardless of the active application, your script will be invoked.

更强大的替代方案是 AutoHotKey:http://www.autohotkey.com/

A more heavy-duty alternative is AutoHotKey: http://www.autohotkey.com/

这篇关于将 VBS 脚本分配给键盘快捷键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆