Very Handy Utility
-
Not sure about you guys but I often need to paste the output of console apps into emails, documents, and the like so what I normally do is: dir /s > test.txt Then open up "test.txt" and then copy and paste the contents to wherever I need it and then delete "test.txt" now this is a pain and I thought there has to be a better way. So I wrote a utility in VB.Net to solve the problem. I would have written this as an article but the .NET Framework has made this so simple the article would be too short :) 1. Create a new console application 2. Add a Reference to System.Windows.Forms 3. Paste this code into the Main function Dim strInput As String strInput = Console.In.ReadToEnd() Windows.Forms.Clipboard.SetDataObject(strInput, True) 4. Compile and put the resulting .exe in your path Now all you need to do is: dir /s | YourProgramName.exe Then go into your email, document, etc. and paste... the program has captured the console output and put it into the clipboard. Hope you guys find this helpful.