<?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>Scripting Wife Learns to Work with Text Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/17/scripting-wife-learns-to-work-with-text-files.aspx</link><description>The Scripting Wife learns to use Windows PowerShell to write to text files and to include the date in a log.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Scripting Wife Learns to Work with Text Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/17/scripting-wife-learns-to-work-with-text-files.aspx#3483588</link><pubDate>Tue, 28 Feb 2012 17:10:08 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3483588</guid><dc:creator>DVillejoin</dc:creator><description>&lt;p&gt;First of all I want to say that I&amp;#39;m new at PowerShell but loving it!! &amp;nbsp;And really enjoy reading the blogs here!&lt;/p&gt;
&lt;p&gt;I was going to ask the simple question... Is there a difference/advantage over using this method or Add-Content cmdlet?&lt;/p&gt;
&lt;p&gt;From the top, I notice two advantages by using the redirection arrows:&lt;/p&gt;
&lt;p&gt;1. &amp;nbsp;&amp;gt;&amp;gt; or &amp;gt; creates the file if it does not exist&lt;/p&gt;
&lt;p&gt;2. &amp;nbsp;&amp;quot;Get-Process | Add-Content -Path filename&amp;quot; adds the raw object (for lack of the correct terminology here, sorry) &amp;quot;System.Diagnostics.Process (powershell_ise)&amp;quot; and not the actual output you normally see in powershell by typing the Get-Process command.&lt;/p&gt;
&lt;p&gt;So when would Add-Content be used advantageously?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;DV&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3483588" width="1" height="1"&gt;</description></item><item><title>re: Scripting Wife Learns to Work with Text Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/17/scripting-wife-learns-to-work-with-text-files.aspx#3481592</link><pubDate>Fri, 17 Feb 2012 15:30:41 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3481592</guid><dc:creator>Vern_Anderson</dc:creator><description>&lt;p&gt;Instead of calling notepad you could also use &amp;quot;Invoke-Item&amp;quot; to call the default app for whatever the file type...&lt;/p&gt;
&lt;p&gt;Invoke-Item C:\fso\myprocesses.txt&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3481592" width="1" height="1"&gt;</description></item><item><title>re: Scripting Wife Learns to Work with Text Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/17/scripting-wife-learns-to-work-with-text-files.aspx#3481536</link><pubDate>Fri, 17 Feb 2012 10:25:11 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3481536</guid><dc:creator>Fábio Jr</dc:creator><description>&lt;p&gt;PowerShell = Powerful as VBScript + Simple as Batch&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3481536" width="1" height="1"&gt;</description></item><item><title>re: Scripting Wife Learns to Work with Text Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/17/scripting-wife-learns-to-work-with-text-files.aspx#3481530</link><pubDate>Fri, 17 Feb 2012 09:36:34 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3481530</guid><dc:creator>K_Schulte</dc:creator><description>&lt;p&gt;Hi Teresa,&lt;/p&gt;
&lt;p&gt;writing to files is really easy in powershell!&lt;/p&gt;
&lt;p&gt;Using outup redirection is identical to the way cmd.exe handles it.&lt;/p&gt;
&lt;p&gt;So we can have our screen dumped to files just by adding a &amp;quot;&amp;gt;&amp;quot; or &amp;quot;&amp;gt;&amp;gt;&amp;quot; sign followed by a filename! That&amp;#39;s simple! ( though I sometimes would prefer having the comparison signs for comparsions, but we get used to this .... sooner or later )&lt;/p&gt;
&lt;p&gt;Have a nice weekend!&lt;/p&gt;
&lt;p&gt;Klaus (Schulte)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3481530" width="1" height="1"&gt;</description></item><item><title>re: Scripting Wife Learns to Work with Text Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/17/scripting-wife-learns-to-work-with-text-files.aspx#3481516</link><pubDate>Fri, 17 Feb 2012 08:47:11 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3481516</guid><dc:creator>Bartek Bielawski</dc:creator><description>&lt;p&gt;Narrative-wise: &amp;quot;sounds expensive&amp;quot; and &amp;quot;That is why they still exist&amp;quot; are my favorites. :)&lt;/p&gt;
&lt;p&gt;PowerShell-wise: I would rather go with Out-File to avoid encoding issues, and issues with butchering long lines... :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3481516" width="1" height="1"&gt;</description></item></channel></rss>