diff --git a/src/System.Management.Automation/engine/lang/parserutils.cs b/src/System.Management.Automation/engine/lang/parserutils.cs index 28dcda71479..180a1fe0f69 100644 --- a/src/System.Management.Automation/engine/lang/parserutils.cs +++ b/src/System.Management.Automation/engine/lang/parserutils.cs @@ -927,7 +927,7 @@ internal static object ReplaceOperator(ExecutionContext context, IScriptExtent e { // only allow 1 or 2 arguments to -replace throw InterpreterError.NewInterpreterException(rval, typeof(RuntimeException), errorPosition, - "BadReplaceArgument", ParserStrings.BadReplaceArgument, ignoreCase ? "-ireplace" : "-replace", rList.Count); + "BadReplaceArgument", ParserStrings.BadReplaceArgument, errorPosition.Text, rList.Count); } if (rList.Count > 0)