Search code examples
powershellparameters

Error: ParentContainsErrorRecordException?


Tried the below code but getting an error with it?

Param(
    [string]$InputFilePath = "C:\Temp\mock1.xlsx",
    [string]$OutputFilePath = "C:\Temp\mockresult.xlsx",
    [string[]]$EMNames
)

At line:12 char:30 [string]$InputFilePath = "C:\Temp\mock1.xlsx", The assignment expression is not valid. Then input to an assignment operator must be an object that is able to accept assignments, such as a variable or a property.

CategoryInfo: ParserError: (:) [], ParentContainsErrorRecordException

FullyQualifiedErrorId : InvalidLeftHandSide


Solution

  • You'll have to put the 'Param' section right on top of your script, I guess that'll fix it. Greetings Johann