Skip to content

Copy and paste with the Microsoft Windows Clipboard when using the Windows Subsystem for Linux

David-Apps edited this page May 16, 2023 · 3 revisions

When using the Windows Subsystem for Linux, you can use these functions to copy to or paste from the Microsoft Windows Clipboard.

# Copy buffer to Clipboard.
# usage: <copy
function+copy {
H-
ebvar-
w !clip.exe
}

# Paste from Clipboard.
# usage: <paste
function+paste {
H-
ebvar-
r !powershell.exe -command 'get-Clipboard' | sed "s/\r$//"
}