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.)
A very simple protocol definition for what you want to do is listed below:
Windows Registry Editor Version 5.00
@="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.
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
(Default) - the description for the protocol, e.g. "Twitter URL".
URL Protocol - this specifies that this is a protocol association and should be left empty.
(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.
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
| 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.