How can I get around using xclip in the Linux subsystem on Win 10?

See WSL issue #1069 for two workarounds:

Just to clarify for anyone who stumbles upon this thread, to use type cat filePath | clip.exe into the command prompt.
- JetStarBlues commented on Feb 8

Or:

I can confirm that having Xming running and configuring the DISPLAY env var is enough to make something go to the windows clipboard:

$ export DISPLAY=:0
$ echo 'some text' | xclip -selection clipboard

This works just fine. Apparently using the primary clipboard also works fine, so I'm guessing Xming will redirect both to the windows clipboard.
- mateusmedeiros commented on Sep 9, 2016


clip.exe < ~/.ssh/id_rsa worked for me to copy my ssh keys to github on WSL2.


I'm using temux all the time, adding this to my .tmux.conf enables me to copy and past without installing an X server :)

#to be able to use mouse buttons and scroll:
set -g mouse on

#to copy to Windows clipboard by marking text
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel clip.exe

#to be able to paste by right clicking (like in default Windows Terminal)
unbind-key MouseDown3Pane
bind-key -n MouseDown3Pane run "tmux set-buffer \"$(powershell.exe -command Get-Clipboard | tr -s '\r\n' ' ')\"; tmux paste-buffer"