Need to run UIRobot from powersehll with arguments containing an embedded quote

I call UIRobot from powershell. Works fine unless the string argument contains a single quote. Then I receive this error:

UiRobot.exe error : UiRobot.exe : After parsing a value an unexpected character was encountered: '.

As seen by the last character in the above error, the issue is with the single quotation character.

My Powershell command line is as follows:

&$robotPath execute --process Activate --input “{‘name’ : ‘Elder’‘s’}”

Several alternative syntax forms did not work. They include:

&$robotPath execute --process Activate --input “{‘name’ : ‘Elder’s’}”
&$robotPath execute --process Activate --input “{‘name’ : 'Elder`‘s’}”
&$robotPath execute --process Activate --input “{‘name’ : ‘$ownersName’}”

How can I pass UIRobot.exe a string parameter containing an embedded single quotation mark?

Have you tested to escape it with backslash?

&$robotPath execute --process Activate --input "{'name' : 'Elder\'s'}"
1 Like

Backslash escape sequence works! Thank You!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.