Skip to content

Instantly share code, notes, and snippets.

@kriskowal
Created February 13, 2010 00:46
Show Gist options
  • Save kriskowal/303158 to your computer and use it in GitHub Desktop.
Save kriskowal/303158 to your computer and use it in GitHub Desktop.
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