Search code examples
powershelllowercase

How to convert the csv to lower case using Powershell script


I wrote the below code to convert a csv to lower case.

(Get-Content "$file" -Raw).ToLower() | Out-File "$outfile"

But Getting error like :

Get-Content : A parameter cannot be found that matches parameter name 'Raw'.

Here is the my error screen shot.


Solution

  • -Raw was added in PowerShell 3.0. If you're using 2.0 or below, it doesn't exist. Instead you can do:

    [System.IO.File]::ReadAllText($file)