Function doSomething($param1 $param2 $file)
{
...doing stuff
$pos = $file.IndexOf('.')
}
doSomething -param1 'stuff' -param2 'more stuff' -file 'C:\test.txt'
Returns error: Method invocation failed because [System.IO.FileInfo] doesn't contain a method named 'IndexOf'.
But calling it outside a function or from the command line works with out issue.
Is this a limitation of powershell or is there some trick to calling string functions inside powershell functions?
Thanks for the help!