<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Can I Copy Script Output to the Clipboard?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/08/13/can-i-copy-script-output-to-the-clipboard.aspx</link><description>Hey, Scripting Guy! Is there any way to have my script output copied to the Clipboard? -- ZW, Marseilles, France 
 
 Hey, ZW. Well, as long as you don&amp;rsquo;t mind crazy work-arounds then, yes, it&amp;rsquo;s actually pretty easy to copy script output to</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Can I Copy Script Output to the Clipboard?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/08/13/can-i-copy-script-output-to-the-clipboard.aspx#3552987</link><pubDate>Sat, 16 Feb 2013 01:41:17 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3552987</guid><dc:creator>Naif</dc:creator><description>&lt;p&gt;Awesome1&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3552987" width="1" height="1"&gt;</description></item><item><title>re: Can I Copy Script Output to the Clipboard?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/08/13/can-i-copy-script-output-to-the-clipboard.aspx#3470311</link><pubDate>Mon, 12 Dec 2011 13:11:29 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3470311</guid><dc:creator>benj9</dc:creator><description>&lt;p&gt;Instead of the IE I like it more to call a HTA to set the clipboard. It&amp;#39;s fast and reliable and does not spam us with a commit dialog.&lt;/p&gt;
&lt;p&gt;Here an example script. The function &amp;#39;SetClipboard&amp;#39; itself just creates a temporary HTA (if it&amp;#39;s not already there, and passes the new clipboard content by command line argument.&lt;/p&gt;
&lt;p&gt;Set oFs = CreateObject(&amp;quot;Scripting.FilesystemObject&amp;quot;)&lt;/p&gt;
&lt;p&gt;Set oWsh = CreateObject(&amp;quot;WScript.Shell&amp;quot;)&lt;/p&gt;
&lt;p&gt;SetClipboard &amp;quot;Hello Clipboard&amp;quot;&lt;/p&gt;
&lt;p&gt;WScript.Echo GetClipboard()&lt;/p&gt;
&lt;p&gt;WScript.Quit&lt;/p&gt;
&lt;p&gt;Sub SetClipboard(sText)&lt;/p&gt;
&lt;p&gt;	Dim sFile, oFile&lt;/p&gt;
&lt;p&gt;	sFile = oWsh.ExpandEnvironmentStrings(&amp;quot;%TEMP%&amp;quot;)&lt;/p&gt;
&lt;p&gt;	If sFile = &amp;quot;%TEMP%&amp;quot; Then sFile = &amp;quot;.&amp;quot;&lt;/p&gt;
&lt;p&gt;	sFile = sFile &amp;amp; &amp;quot;\~SetClipboard.hta&amp;quot;&lt;/p&gt;
&lt;p&gt;	WScript.Echo sFile&lt;/p&gt;
&lt;p&gt;	If Not oFs.FileExists(sFile) Then&lt;/p&gt;
&lt;p&gt;		Set file = oFs.CreateTextFile(sFile, True)&lt;/p&gt;
&lt;p&gt;		file.WriteLine &amp;quot;&amp;lt;HTA:APPLICATION id=c APPLICATIONNAME=/&amp;gt;&amp;lt;SCRIPT language=VBScript&amp;gt;&amp;quot; _&lt;/p&gt;
&lt;p&gt;			&amp;amp; &amp;quot;document.parentwindow.clipboardData.SetData &amp;quot;&amp;quot;text&amp;quot;&amp;quot;,&amp;quot; _&lt;/p&gt;
&lt;p&gt;			&amp;amp; &amp;quot;Right(C.commandLine,Len(c.commandLine)-InStr(2,c.commandLine,Chr(34))-1):window.close&amp;quot; _&lt;/p&gt;
&lt;p&gt;			&amp;amp; &amp;quot;&amp;lt;/SCRIPT&amp;gt;&amp;lt;/HTA:APPLICATION&amp;gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;		file.Close : Set file = Nothing	&lt;/p&gt;
&lt;p&gt;	End If&lt;/p&gt;
&lt;p&gt;	oWsh.Run sFile &amp;amp; &amp;quot; &amp;quot; &amp;amp; sText, 0, True&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;Function GetClipboard()&lt;/p&gt;
&lt;p&gt;	GetClipboard = CreateObject(&amp;quot;htmlfile&amp;quot;).ParentWindow.ClipboardData.GetData(&amp;quot;text&amp;quot;)&lt;/p&gt;
&lt;p&gt;End Function&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3470311" width="1" height="1"&gt;</description></item><item><title>re: Can I Copy Script Output to the Clipboard?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/08/13/can-i-copy-script-output-to-the-clipboard.aspx#3444751</link><pubDate>Tue, 02 Aug 2011 19:07:55 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3444751</guid><dc:creator>Ed Wilson</dc:creator><description>&lt;p&gt;@JeremyEngleWork you are welcome.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3444751" width="1" height="1"&gt;</description></item><item><title>re: Can I Copy Script Output to the Clipboard?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/08/13/can-i-copy-script-output-to-the-clipboard.aspx#3444750</link><pubDate>Tue, 02 Aug 2011 19:01:01 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3444750</guid><dc:creator>JeremyEngelWork</dc:creator><description>&lt;p&gt;Hey thanks, Ed! I learned something new today!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3444750" width="1" height="1"&gt;</description></item><item><title>re: Can I Copy Script Output to the Clipboard?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/08/13/can-i-copy-script-output-to-the-clipboard.aspx#3444745</link><pubDate>Tue, 02 Aug 2011 17:55:52 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3444745</guid><dc:creator>Ed Wilson</dc:creator><description>&lt;p&gt;@T Luke you can use the clip.exe program that is part of the operating system. In Windows PowerShell it is as simple as this:&lt;/p&gt;
&lt;p&gt;&amp;quot;Copy this string to the clipboard&amp;quot; | clip&lt;/p&gt;
&lt;p&gt;Using VBScript, you will need to create the wshshell object and use the exec method to start clip, and then play around with stdin to get your input. But it can be done ... Nowdays, attempting to automate IE is a hit or miss proposition due to all the security changes -- this particular article was written more than 7 years ago. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3444745" width="1" height="1"&gt;</description></item><item><title>re: Can I Copy Script Output to the Clipboard?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/08/13/can-i-copy-script-output-to-the-clipboard.aspx#3444742</link><pubDate>Tue, 02 Aug 2011 17:41:09 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3444742</guid><dc:creator>T Luke</dc:creator><description>&lt;p&gt;Is there a way to do this without IE?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3444742" width="1" height="1"&gt;</description></item><item><title>re: Can I Copy Script Output to the Clipboard?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/08/13/can-i-copy-script-output-to-the-clipboard.aspx#3299421</link><pubDate>Wed, 09 Dec 2009 16:52:36 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3299421</guid><dc:creator>Manfred88</dc:creator><description>&lt;p&gt;Hello, Script Guy!&lt;/p&gt;
&lt;p&gt;I want to send my highlighted lines to the ClipBoard.&lt;/p&gt;
&lt;p&gt;I want to do it as one of my steps inside a VBS script.&lt;/p&gt;
&lt;p&gt;I cannot &amp;nbsp;use the common Ctrl+C.&lt;/p&gt;
&lt;p&gt;-----&lt;/p&gt;
&lt;p&gt;Is it at all possible ?&lt;/p&gt;
&lt;p&gt;Manfred Lutz.&lt;/p&gt;
&lt;p&gt;*******************&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3299421" width="1" height="1"&gt;</description></item></channel></rss>