Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You don't say what isn't working, so here are some generic suggestions. If you can post any error messages, or specific things that aren't working, I can be more specific.</p> <p>As a commenter stated, <code>(Get-Date).ToString()</code> returns something like <code>7/10/2013 7:38:22 AM</code>, which may or may not work in a filename. You'll want to format it so that you know it will work in a filename, e.g. <code>$fileName = '{0:yyyy-MM-dd-HH-mm-ss}.txt' -f (Get-Date)</code>.</p> <p>Second, PowerShell has an <a href="http://technet.microsoft.com/en-us/library/ee176874.aspx" rel="nofollow">Import-Csv</a> function which will read a CSV file and turn it into objects. You can then process each object, which will have properties for each column of the CSV, returning a string that you want in your destination file.</p> <p>Here is an updated script:</p> <pre><code>$fileName = '{0:yyyy-MM-dd-HH-mm-ss}.txt' -f (Get-Date) $outputFile = Join-Path 'C:\Users\&lt;username&gt;\Desktop' $filename New-Item $outputFile -ItemType File Import-Csv -Path 'C:\Users\&lt;username&gt;\Desktop\test.csv' | ForEach-Object { " &lt;tr&gt;&lt;td&gt;{0}&lt;/td&gt;&lt;td&gt;{1}&lt;/td&gt;&lt;td&gt;{2}&lt;/td&gt;&lt;td&gt;{3}&lt;/td&gt;&lt;td&gt;{4}&lt;/td&gt;&lt;td&gt;{5}&lt;/td&gt;&lt;td&gt;{6}&lt;/td&gt;&lt;td&gt;{7}&lt;/td&gt;&lt;td&gt;{8}&lt;/td&gt;&lt;td&gt;{9}&lt;/td&gt;&lt;td&gt;{10}&lt;/td&gt;&lt;td&gt;{11}&lt;/td&gt;&lt;td&gt;{12}&lt;/td&gt;&lt;td&gt;{13}&lt;/td&gt;&lt;/tr&gt;" -f ` $_.Date,$_.Time,$_.'Call Type',$_.'Calling Number',$_.'Calling Extension',$_.'Calling Department',$_.'Called Number',$_.'Called Extension',$_.'Called Department',$_.'Call Connected',$_.Duration,$_.'Queuing Time',$_.'Account Code',$_.'Carrier Code' } | Add-Content $outputFile </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload