Showing results for 
Show  only  | Search instead for 
Did you mean: 

Removing the Newline Character from Execute Script/Batch File and Execute Command Actions' stdout

Removing the Newline Character from Execute Script/Batch File and Execute Command Actions' stdout


How to remove the newline or carriage return character from $EXECUTE_STDOUT$ for Execute Script/Batch File and Execute Command Actions.


When running an Execute Script/Batch File action or an Execute Command action, the STDOUT value will be returned with a newline character appended to the end of the string. This newline character may be unwanted when stored in an InstallAnywhere variable. The steps outlined below provide a way to remove the newline character from the variable's value.


To remove a newline character as well as any white spaces from the beginning and end of a string, a Custom Code action can be used. The steps below uses the ModifyString Custom Code action available from Flexera Software's website: InstallAnywhere Custom Code Extensions
  1. Download the ModifyString extension.
  2. Add a Set InstallAnywhere Variable action and set $MS_STRING_TO_CONVERT$ to the variable that contains the string with a newline character (i.e. $MS_STRING_TO_CONVERT$ = $EXECUTE_STDOUT$).
  3. Follow the General Instructions in the ModifyString.htm to implement the custom action.
  4. Use the $MS_STRING_TRIM$ output variable that gets set by the ModifyString action to obtain the new string value with the newline character removed.

Additional Information

When executing a command that prevents a newline character from being created, such as the following on Linux:
echo -n $variable
a newline character is still added to the string stored in the $EXECUTE_STDOUT$ InstallAnywhere variable set by the action. An enhancement request has been submitted to our Engineering team as Issue# IOA-000066612 to address this. Our Engineering team is investigating this issue, but at this moment, there is no estimated time frame for when a fix will be implemented.

Was this article helpful? Yes No
No ratings
Version history
Revision #:
1 of 1
Last update:
‎Nov 12, 2018 04:43 PM
Updated by: