Skip to content

Instantly share code, notes, and snippets.

@jpflouret
Last active December 29, 2023 03:33
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jpflouret/19da43372e643352a1bf to your computer and use it in GitHub Desktop.
Save jpflouret/19da43372e643352a1bf to your computer and use it in GitHub Desktop.
paste.exe

Pipe contents of windows clipboard to another command

Usage

To pipe the contents of the clipboard to another command (e.g. grep):

paste | grep pattern

To save the contents of the clipboard to a file:

paste > file.txt

Building

You can compile paste.cs with a single command on any Windows machine without the need to install any extra tools. Just run this command:

%SystemRoot%\Microsoft.NET\Framework\v3.5\csc /o paste.cs

Prebuild version is included here as paste.zip

Installing

Put the resulting paste.exe in your path.

using System;
using System.Windows.Forms;
namespace jpf {
class paste {
[STAThread]
public static int Main(string[] args) {
Console.Write(Clipboard.GetText());
return 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment