Skip to content

Replacement for clip.exe in Windows that supports both read from/write to clipboard and uses UTF-8 encoding.

License

Notifications You must be signed in to change notification settings

WuTao18/utf8clip

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

utf8clip NuGet

Replacement for clip.exe in Windows that supports both read from/write to clipboard and uses UTF-8 encoding by default.

Works well with PowerShell Core or console programs that explicitly output UTF-8 text.

Installation

utf8clip is published as a .NET Core Global Tool so you can install it directly from the command line:

dotnet tool install --global utf8clip

You can also download utf8clip and manually copy it to a directory in your PATH.

.NET Core 3.0 or later runtime is required.

Usage

If started with file/piped input:

  • Copies the input, interpreted as UTF-8 text†, to the Windows clipboard.

Otherwise:

  • Prints the contents of the Windows clipboard to output as UTF-8 text.

†If there is a byte-order mark in the input it will be respected, e.g. for UTF-16 encoded files.

Examples

Copy program output to clipboard

<program> | utf8clip

Places a copy of the UTF-8 output from on to the Windows clipboard.

Note that most native Windows commands like dir do not write UTF-8 output unless the console codepage is changed with chcp.

Copy file content to clipboard

utf8clip < README.md

Places a copy of the text from README.md on to the Windows clipboard.

Write clipboard content to console

utf8clip

Writes the current contents of the Windows clipboard to the console.

PowerShell Core Examples

Copy program output to clipboard

ls | utf8clip

Places a copy of the current directory listing on to the Windows clipboard.

This works correctly as PowerShell Core uses UTF-8 output by default.

Copy file content to clipboard

cat .\README.md | utf8clip

Places a copy of the text from README.md on to the Windows clipboard.

Write clipboard content to console

utf8clip

Writes the current contents of the Windows clipboard to the console.

About

Replacement for clip.exe in Windows that supports both read from/write to clipboard and uses UTF-8 encoding.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%