Search code examples
powershellpentahopentaho-spoon

PowerShell script in Pentaho


I would like to use a PowerShell script to count lines in a text file. I use this code:

Set-Location -Path D:\
$measure = Get-Content b27.csv | Measure-Object 
$lines = $measure.Count
echo "line count is: ${lines}"

However, I have got error. I think there is something missing to tell pentaho to execute the PowerShell script

After that I try to add this code

powershell.exe -ExecutionPolicy Bypass [D:\]
call Set-Location -Path D:\
call $measure = Get-Content b27.csv | Measure-Object 
call  $lines = $measure.Count
call echo "line count is: ${lines}"

but it doesn't work.

Please find the error as below:

error message


Solution

  • Could you use the "Get Files Rows Count" step? It would be cross platform that way.