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

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

问题描述

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

我意识到这个问题与编程甚至脚本都不直接相关,但是我无法在线或通过自己的实验找到直接的答案.我确定某个地方有一个简单的解决方案...

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

解决方案

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

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

然后,每当您按Ctrl + Alt + K组合键时,无论处于活动状态的应用程序都将调用您的脚本.

更重的替代方法是AutoHotKey: http://www.autohotkey.com/

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 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).

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).

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

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

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

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