When I click on this link, Windows tries to open it with an app. This is because the URI is structured as: twitter://realDonaldTrump/status/266259787405225984 with twitter being in the link's protocol position.

When I click on this link in a Windows 10 UWP like 'Messenger', I can't resolve it due to Windows registering it as an app URI. Which makes sense but I would like to have some control over this behavior.


How can I add a "Copy URI to clipboard" button to the "Open With" dialogue box? Seen below is an image of what I am talking about:

enter image description here

1 Answer 1


I'm not aware of a way to add this to the Open With dialog, but it is possible to have copying the URI be the default action for that protocol. This is possible with some modification of the registry. For the most part, file and protocol associations are exactly what you would enter to run something from the command line.

The file and protocol associations are stored to and read from the HKEY_CLASSES_ROOT registry hive. (For more information on file associations, this answer may help you.)

The .reg file

A very simple protocol definition for what you want to do is listed below:

; twitter_protocol.reg
Windows Registry Editor Version 5.00

"URL Protocol"=""



@="cmd /c ECHO|SET /P=%1|CLIP"

Copy this into a file called twitter_protocol.reg and double click on it to import this into your registry.

The explanation

There are many options you can specify inside these keys. The important ones in the case of a protocol association are:

  • HKEY_CLASSES_ROOT\<protocol> - the string before the ://.
  • HKEY_CLASSES_Root\<protocol> - (Default) - the description for the protocol, e.g. "Twitter URL".
  • HKEY_CLASSES_ROOT\<protocol> - URL Protocol - this specifies that this is a protocol association and should be left empty.
  • HKEY_CLASSES_ROOT\<protocol>\shell\open\command - (Default) - specifies the command line to open the associated application.

In this case, we set the command line option to cmd /c ECHO|SET /P=%1|CLIP, so let's break that down:

  • cmd /c ... will open a command prompt window to run your command. ECHO and SET are command line routines, rather than separate applications on their own, so we need a command prompt running to use it.
  • ECHO|SET /P=%1 is an overly complicated way of saying "print the input without an extra new line at the end".
    • ECHO by itself will print whatever is written after it to the command prompt and add an extra line after it.
    • |SET /P= is a hack used to remove the newline. SET is normally used to set environment variables, but we don't use it for that in this case. | is explained below.
    • %1 is the input. In this case it is twitter://realDonaldTrump/status/266259787405225984.
  • | is called the "pipe character", which means that we are taking the output of what comes before it and giving it as input to what comes after it.
  • CLIP will read pipe input (as opposed to using a command line argument, which it doesn't support) and copy that to the clipboard.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .