<?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>How Can I Clear the Contents of a Text File?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2007/06/11/how-can-i-clear-the-contents-of-a-text-file.aspx</link><description>Hey, Scripting Guy! How can I clear the contents of a text file? -- JJ 
 Hey, JJ. Well, today is Monday, June 11 th , and the Scripting Guys are finally back from a week in Orlando . After all that time spent lounging around in luxury hotels, eating</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: How Can I Clear the Contents of a Text File?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2007/06/11/how-can-i-clear-the-contents-of-a-text-file.aspx#3569566</link><pubDate>Mon, 29 Apr 2013 03:11:47 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3569566</guid><dc:creator>jrv</dc:creator><description>&lt;p&gt;@Jarrod&lt;/p&gt;
&lt;p&gt;Hey - the big boys uptown learn a language every week just to keep in shape. I learn a new language whenever I find one because it keeps me out of trouble.&lt;/p&gt;
&lt;p&gt;You should be happy that you get to learn something new. &amp;nbsp;VBScript is obsolete now anyway. &amp;nbsp;Don&amp;#39;t waste your time on it. &amp;nbsp;It is much easier to do in PowerShell anyway. &amp;nbsp;This can be done in VBScript but it takes a very good technician to figure out how to do it. &amp;nbsp;In PosH it takes one line.&lt;/p&gt;
&lt;p&gt;Post all of your questions in the forum. &amp;nbsp;You will be surprised at what you find.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3569566" width="1" height="1"&gt;</description></item><item><title>re: How Can I Clear the Contents of a Text File?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2007/06/11/how-can-i-clear-the-contents-of-a-text-file.aspx#3569563</link><pubDate>Mon, 29 Apr 2013 02:31:48 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3569563</guid><dc:creator>Jarrod</dc:creator><description>&lt;p&gt;Thanks for the reply jrv, but I am really disappointed in that, as I now have to learn another language.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3569563" width="1" height="1"&gt;</description></item><item><title>re: How Can I Clear the Contents of a Text File?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2007/06/11/how-can-i-clear-the-contents-of-a-text-file.aspx#3569562</link><pubDate>Mon, 29 Apr 2013 02:24:47 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3569562</guid><dc:creator>jrv</dc:creator><description>&lt;p&gt;@Jarrod - all of the files you listed are text files.&lt;/p&gt;
&lt;p&gt;You cannot use wildcards in VBScript. &amp;nbsp;YOu can use wildcards in PowerShell.&lt;/p&gt;
&lt;p&gt;If you have issues then you need to post here: &amp;nbsp;•Scripting Forum:&lt;a rel="nofollow" target="_new" href="http://social.technet.microsoft.com/Forums/en-US/ITCG/threads"&gt;social.technet.microsoft.com/.../threads&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3569562" width="1" height="1"&gt;</description></item><item><title>re: How Can I Clear the Contents of a Text File?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2007/06/11/how-can-i-clear-the-contents-of-a-text-file.aspx#3569559</link><pubDate>Mon, 29 Apr 2013 01:57:10 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3569559</guid><dc:creator>Jarrod</dc:creator><description>&lt;p&gt;Any suggestions to my last post? I am trying to add a particular bit of code to several text files all of different types (text, php, js, html)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3569559" width="1" height="1"&gt;</description></item><item><title>re: How Can I Clear the Contents of a Text File?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2007/06/11/how-can-i-clear-the-contents-of-a-text-file.aspx#3568846</link><pubDate>Wed, 24 Apr 2013 17:30:47 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3568846</guid><dc:creator>Jarrod</dc:creator><description>&lt;p&gt;Can I do this using wildcards? ex: Set objFile = objFSO.OpenTextFile(&amp;quot;C:\Scripts\*..txt&amp;quot;, ForWriting)&lt;/p&gt;
&lt;p&gt;or even *.* as all files in the folder will be modified.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Jarrod&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3568846" width="1" height="1"&gt;</description></item><item><title>re: How Can I Clear the Contents of a Text File?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2007/06/11/how-can-i-clear-the-contents-of-a-text-file.aspx#3506317</link><pubDate>Wed, 27 Jun 2012 18:09:51 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3506317</guid><dc:creator>jrv</dc:creator><description>&lt;p&gt;@all - The file must be opened &amp;quot;ForWriting&amp;quot; (mode 2) for the first write to clear the file. &amp;nbsp;Subsequent writes will then append. &amp;nbsp;If the file is opened in mode=8 (ForAppending) then the write will always append and obj.Write &amp;quot;&amp;quot; will append a blank line.&lt;/p&gt;
&lt;p&gt;If you always want a file with nothing in it including a blank line the you must use CreateTextFile.&lt;/p&gt;
&lt;p&gt;set f = fso.CreateTextFile( filename, True)&lt;/p&gt;
&lt;p&gt;f.Close&lt;/p&gt;
&lt;p&gt;This will overwrite the file with a blank file with no blank lines. &amp;nbsp;It will be a truly empty file.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3506317" width="1" height="1"&gt;</description></item><item><title>re: How Can I Clear the Contents of a Text File?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2007/06/11/how-can-i-clear-the-contents-of-a-text-file.aspx#3506260</link><pubDate>Wed, 27 Jun 2012 14:39:14 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3506260</guid><dc:creator>IamMred</dc:creator><description>&lt;p&gt;@Frustrated scripter ... humm ..... well, using objfile.write &amp;quot;&amp;quot; should be a blank (empty) line ... I suspect that you have an extra pair of quotes or something going on ...&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3506260" width="1" height="1"&gt;</description></item><item><title>re: How Can I Clear the Contents of a Text File?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2007/06/11/how-can-i-clear-the-contents-of-a-text-file.aspx#3506252</link><pubDate>Wed, 27 Jun 2012 14:28:27 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3506252</guid><dc:creator>Frustrated Scripter</dc:creator><description>&lt;p&gt;Hey scripting guy! This isn&amp;#39;t working for me!&lt;/p&gt;
&lt;p&gt;Obj.Write &amp;quot;&amp;quot; simply adds &amp;quot;&amp;quot; to the end of whatever text file it refers to. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3506252" width="1" height="1"&gt;</description></item><item><title>re: How Can I Clear the Contents of a Text File?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2007/06/11/how-can-i-clear-the-contents-of-a-text-file.aspx#3434882</link><pubDate>Sat, 11 Jun 2011 02:50:26 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3434882</guid><dc:creator>GSenanayake</dc:creator><description>&lt;p&gt;WOW.... Great &amp;nbsp;, i &amp;nbsp;was looking &amp;nbsp;for this... this helped me a lot .....&lt;/p&gt;
&lt;p&gt;Tks&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3434882" width="1" height="1"&gt;</description></item></channel></rss>