Context switching out of Remote Desktop via keyboard command

Great post... I have had very similar needs in the past and have a few ways I've been able to do this (or similar enough to adapt to what you're trying to do)--I tend to leverage AutoHotkey but you can use whatever.

  1. Run two background scripts or programs, one local, one remote, using the shared clipboard capability of RDP or similar remote-desktop software. Trigger a hotkey of your choice on the remote side to set the clipboard to a unique string, and detect that string on the clipboard on the local side (since the clipboard will automatically get passed back to the local side where changes can be detected, for example in AutoHotkey using the OnClipboard command). On the local side you can then execute whatever you want (restore the window if you like, or shell-execute another program). Finally, on the remote or local side, the original clipboard can be restored or wiped after action is taken. This has worked very well for me but the only downside--depending on your connection latency--is the transfer time of the clipboard on your link. This method didn't always feel 'snappy' per se, but was perfectly functional.

  2. Use a keyboard that leverages keyboard-specific driver/software. Logitech has this for most of their keyboards as well as other USB add-on keypads. On a Logitech keyboard for example, you can set Fn+[F1 through F12] to run another program, script, etc. So for example you can assign Fn+F10 to run a program that will restore the RDP window, and this keypress will not get sent to the RDP session since the Logitech driver/software detects it and will run the program locally that it's assigned to run. A slight variation on this that can also be used if you don't want to change keyboards is to get a separate USB keypad--there are cheaper and more expensive versions, but anything that comes with a driver program where you can set it to run an external program or executable will work.

  3. Finally, an option I have not implemented before, but which may be feasible, is using AutoHotkey HID code to use an additional keyboard or mouse you have laying around (so it has the same keys basically and you might have one handy, vs. having to buy something). In this scenario, you detect HID-specific input from that device (vs. your regular keyboard/mouse), even though it would be sending the same keys/buttons, and then execute a program locally to restore the RDP window.