Console: How to export the command output to clipboard

We know how helpful to copy the command output into clipboard directly from command prompt. We normally push the output to a text file and copy it to where ever we need. The following command pumps the output of a command to clipboard.