How to turn a keyboard shortcut into a Desktop shortcut?

5,285

You could use a VBS script to do this with sendkeys.

Create a text file with a .vbs extension, and create a WScript Shell object, then use sendkeys. I just tried this with ctrl-shift-escape to open task manager:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "^+{ESCAPE}"

Found the info here.

Share:
5,285
keling
Author by

keling

Windows Insider MVP

Updated on September 18, 2022

Comments

  • keling
    keling over 1 year

    Here is my dilemma:

    I use several keyboard shortcuts to be more productive and get faster access to certain things in Windows. But... is there a way to translate those keyboard combinations into a shortcut file that can be placed on the desktop and run with the mouse? I am referring only to keyboard shortcuts that can be used to get around Windows, not shortcuts for specific applications.

    This will be very useful to other users who are not that into keyboard shortcuts.

    • uSlackr
      uSlackr about 12 years
      A specific example would be helpful.
    • keling
      keling about 12 years
      A very simple example is the Windows key on the keyboard, which opens the Start Menu. Or Control + C. How do you translate such keyboard shortcuts into a shortcut file.
    • Gauthier
      Gauthier about 12 years
      As I understand it, you want several ways to perform one single action. Rather than making the file trigger the shortcut, that then triggers the action, I find it more logical to have both the file and the shortcut perform the action directly. file -> win-key -> start menu seems less logical than file -> start menu and win-key -> start menu separately. Maybe it's not practical in your case, but you can consider it.
  • xdumaine
    xdumaine about 12 years
    I think you have it backwards. I interpreted his question has how to have a shortcut file trigger a keyboard shortcut, but your answer is how to have a keyboard shortcut trigger a shortcut file. Note how he's trying to not have to use keyboard shortcuts, as he says it'd be useful for those who are not that into keyboard shortcuts.
  • Gauthier
    Gauthier about 12 years
    I automatically interpreted that the keyboard shorcuts in question were custom ones. The result of my answer is a desktop file doing whatever OP wants, and a keyboard shortcut to trigger that file. That way he can continue to use his (assumingly custom) shortcut, while mouse-trapped users can use the shortcut. Everyone is happy. But I see your point. If OP wants a way to e.g. open the system settings with win+pause, I would say that the correct way is not to have a desktop file trigger win+pause, but to have the file open the system settings itself.
  • Gauthier
    Gauthier about 12 years
    and as the comment says, an example would clarify greatly.
  • keling
    keling about 12 years
    This is good info. Thanks. Plus, it has the advantage of not requiring to use a third-party tool.
  • keling
    keling about 12 years
    What is the code for the Windows key?
  • xdumaine
    xdumaine about 12 years
    @CorporateGeek I was trying to find that actually. The closest I could find was ctrl-escape, but that doesn't work for windows key combinations, it just opens the start menu. I'll keep looking, but you should post back here if you find it.
  • keling
    keling about 12 years
    You code sample was returning an error. Something with expected end of line missing. I found another approach which worked. Option Explicit Dim objShell : Set objShell = CreateObject("WScript.Shell") objShell.SendKeys "^{esc}"
  • keling
    keling about 12 years
    Thanks for pointing me in the right direction though.