"Unexpected token '&01' in expression or statement." via Powershell script in a Windows Interpeter

Document ID : KB000090534
Last Modified Date : 14/04/2018
Show Technical Document Details
Issue:
"Unexpected token '&01' in expression or statement." via Powershell script in a Windows Interpeter
Resolution:

Symptoms

When attempting to run a job that uses Powershell and a Windows Interpeter your job fails and the report results appear similar to:

Unexpected token 'Default' in expression or statement.
At C:\UC4WA9\Agents\VWASUP03_WIN_POWERSHELL\TEMP\JAADJTVB.TXT.PS1:2 char:11
+ '  Default <<<<  value used -> '&PASSED#'='C:\WINDOWS'.
    + CategoryInfo          : ParserError: (Default:String) [], ParseException
    + FullyQualifiedErrorId : UnexpectedToken


Cause

The Windows Header information is being used when a :READ statement is ran. Powershell attempts to interpret this directly which causes the 'Default' line to be entered and subsequently throw the error.


Resolution

Use the "I" parameter for Input Handling in your :READ statements to suppress documentation generation:

:READ <Variable>,,,,"I"

More information can be found in the documentation under Automic Script Guide --> Ordered by Function --> Activate Objects --> :READ