powershell - How do I handle System Management.Automation.ParameterBindingArgumentTransformationException -


please help. stuck exception handling. have files must read , make small changes to. there instances required file not found , in case, move on next file. before happens getting error 2017-07-25 12:19:25 [ps-error]: (file_migration.ps1) (invoke-mainscript) cannot process argument transformation on parameter 'path'. cannot convert value type system.string.

the error pointing function remove-tableofcontents -path $filepath. here code wrote function.

function remove-tableofcontents {     [cmdletbinding()]     param     (         [parameter(mandatory=$true)]         [string]$path,          [string]$macro = $script:regextocmacro     )     $filecontent = get-content -path $path     $filecontent = $filecontent -replace $macro, ''     if([string]::isnullorempty($path))     {         invoke-mainscript                 }     set-content -path $path -value $filecontent     get-content $filecontent | where-object {$_ -match $path} | invoke-mainscript   } 

i have checked around , read lot not finding solution past problem. appreciated.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -