Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In MacOSX there's a command which can pipe the output of a command to the clipboard so that it can be pasted somewhere else in the GUI.

Does Windows have an equivalent command or utility for doing this from cmd.exe or maybe in the form of a Powershell cmdlet?

share|improve this question
up vote 25 down vote accepted

Use something like:

someCommand | clip

That will pipe the result to the windows clipboard

share|improve this answer
    
Good suggestion. This is a standard Windows utility. On most systems, it's at C:\Windows\system32\clip.exe. – Nicole Hamilton Sep 11 '12 at 3:48
    
@NicoleHamilton right, but since that is part of the PATH variable, that does not need to be made explicit – soandos Sep 11 '12 at 3:50
    
My point and part of the reason I gave you an upvote was that I liked that you'd suggested a standard Windows utility, not something the OP was supposed to d/l from somewhere. Most people know about PATH. – Nicole Hamilton Sep 11 '12 at 4:25
2  
For posterity, if you want the content of a file it's 'type somefile.txt | clip' – ferventcoder Feb 2 '14 at 21:10
    
Annoyingly windows echo adds a \r\n and has no echo -n ... so "echo test | clip" will have test\r\n in copy buffer ... echo|set/p="test"|clip ... addresses this gross – hpavc Feb 11 '15 at 4:11

Just for reference I had to copy my public key directly after Bitbucket was giving me a bad key warning. I was able to use @soandos answer like so:

cat ~/.ssh/id_rsa.pub | clip to copy my key directly from the command line on a PC. (since command line sucks compared to terminal)

share|improve this answer

You must log in to answer this question.

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