0

How do you access the (windows) clipboard in WSL so that you can pipe it into commands, use it as stdin, etc.?

There's more than enough answers about how to write to the clipboard. But I couldn't find any specifically about reading from it.

For what it's worth: I'm answering my own question. Hopefully this saves others time in the future.

Daniel Kaplan
  • 757
  • 10
  • 25

1 Answers1

3
alias pbpaste="powershell.exe -noprofile Get-Clipboard"
alias pbcopy="clip.exe"

You can put something like that in your .bashrc file or run the commands directly.


I learned the answer from this question: Linux clipboards, including with WSL consoles But, it is not asking the same thing and after 10 minutes of googling, I still can't find a direct answer to my question.

Daniel Kaplan
  • 757
  • 10
  • 25