Skip to content

Instantly share code, notes, and snippets.

@adithya-s-sekhar
Forked from jpflouret/README.md
Created November 20, 2023 12:07
Show Gist options
  • Select an option

  • Save adithya-s-sekhar/0d4f192f5c89e60ffcb6be335fb75734 to your computer and use it in GitHub Desktop.

Select an option

Save adithya-s-sekhar/0d4f192f5c89e60ffcb6be335fb75734 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