Skip to content

Instantly share code, notes, and snippets.

@kriskowal

kriskowal/pbcopy.cs

Created Feb 13, 2010
Embed
What would you like to do?
using System;
namespace Pastebin
{
class Pbcopy
{
[STAThread]
static void Main(string[] args)
{
try
{
System.Windows.Forms.Clipboard.SetDataObject(
System.Console.In.ReadToEnd(),
true
);
}
catch ( System.Exception )
{
System.Console.Out.WriteLine("Unable to post to clipboard");
throw;
}
}
}
}
using System;
namespace Pastebin
{
using System;
using System.Windows.Forms;
class Pbpaste
{
[STAThread]
static void Main(string[] args)
{
try
{
Console.Out.Write( Clipboard.GetDataObject().GetData(
System.Windows.Forms.DataFormats.StringFormat
) );
}
catch ( Exception )
{
Console.Out.WriteLine( "Unable to post clipboard contents" );
throw;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.