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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -