【问题标题】:How to set up keyboard shortcuts from windows command line?如何从 Windows 命令行设置键盘快捷键?
【发布时间】:2012-09-01 11:09:35
【问题描述】:

我想创建一个批处理文件来分配键盘快捷键。

例如,如何使用 Alt+5 键启动 Internet Explorer?

【问题讨论】:

  • 网上没有很多,主要是关于如何将exe作为快捷键添加到键盘的指南

标签: file batch-file keyboard shortcut assign


【解决方案1】:

使用 NirCmd
http://www.nirsoft.net/utils/nircmd.html
您可以创建文件快捷方式,并为这些文件shotrcut分配一个热键

在这里查看 NirCmd 的帮助:
http://www.nirsoft.net/utils/nircmd2.html#using

shortcut [filename] [folder] [shortcut title] {arguments} {icon file} {icon resource number} {ShowCmd} {Start In Folder} {Hot Key}
Creates a shortcut to a file.
The parameters:

    [filename]: Create a shortcut to this filename.
    [folder]: Specify the destination folder that inside it the shortcut will be created. You can specify any valid folder, including the special variables that represent system folders, like ~$folder.desktop$ (Desktop folder), ~$folder.programs$ (Start-Menu-Programs folder), and so on...
    [shortcut title]: The text displayed in the shortcut.
    {arguments}: Optional parameter - Additional arguments to execute the filename.
    {icon file}: Optional parameter - Use this parameter if your want that the shortcut will be displayed with icon other than the default one.
    {icon resource number}: Optional parameter - The resource number inside the icon file.
    {ShowCmd}: Optional parameter - Use this parameter if you want to maximize or minimize the window of the program. Specify "max" to maximize the window or "min" to minimize it.
    {Start In Folder}: Optional parameter - Specifies the "Start In" folder. If you don't specify this parameter, the "Start In" folder is automatically filled with the folder of the program you specify in [filename] parameter.
    {Hot Key}: Optional parameter - Specifies an hot-key that will activate the shortcut. For example: Alt+Ctrl+A, Alt+Shift+F8, Alt+Ctrl+Shift+Y 


Examples:
shortcut "f:\winnt\system32\calc.exe" "~$folder.desktop$" "Windows Calculator"
shortcut "f:\winnt\system32\calc.exe" "~$folder.programs$\Calculators" "Windows Calculator"
shortcut "f:\Program Files\KaZaA\Kazaa.exe" "c:\temp\MyShortcuts" "Kazaa"
shortcut "f:\Program Files" "c:\temp\MyShortcuts" "Program Files Folder" "" "f:\winnt\system32\shell32.dll" 45
shortcut "f:\Program Files" "c:\temp\MyShortcuts" "Program Files Folder" "" "" "" "max" 

【讨论】:

    【解决方案2】:

    1) 创建 Internet Explorer 的快捷方式,并将其放在桌面上。
    2) 右键单击​​快捷方式,然后单击Properties
    3) 点击Keyboard Shortcut旁边的方框。
    4) 按ALT+5(框会显示CTRL+ALT+5)
    5) 点击->OK

    将快捷方式保留在桌面或开始菜单* 上很重要,否则它将不起作用。
    AFAIK 你必须用这个方法创建一个 CTRL+ALT+? 快​​捷方式。

    *已编辑以包含 Andriy M 关于Start Menu 的观点。

    【讨论】:

    • '将快捷方式保留在桌面上很重要......' - 或开始菜单中的某个位置。
    • @AndriyM:我从来不知道!如果我知道的话,这些年来我有时可能会使用它。 :D
    猜你喜欢
    • 2013-09-25
    • 2014-11-04
    • 2017-07-07
    • 2011-05-26
    • 1970-01-01
    • 2011-06-06
    • 1970-01-01
    • 1970-01-01
    • 2022-01-09
    相关资源
    最近更新 更多