Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Writes a text to input stream.

Component Version macOS Windows Linux Server iOS SDK
Shell 7.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ❌ No
MBS( "Shell.WriteInputText"; ShellRef; Text { ; Encoding } )   More


Parameter Description Example Flags
ShellRef The reference number from the shell. $shell
Text The text to send. "Hello World"
Encoding The text encoding for text parameter.
Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ.
"UTF-8" Optional


Returns OK or error.


Writes a text to input stream.
The child process and read this from the input stream.
Please make sure you use right line endings and encoding.

You must call Shell.Execute first to start the child process, before you send data.


Sends text to shell:

MBS( "Shell.WriteInputText"; $shell; "Hello World"; "UTF-8")

Write input with CR and LF on the end:

If [ Length(Shell::Input) > 0 ]
    Set Variable [ $s ; Value: MBS( "Shell.WriteInputText"; $shell; Shell::Input; "UTF-8") ]
    Set Variable [ $s ; Value: MBS( "Shell.WriteInputText"; $shell; Char(13); "UTF-8") ]
    Set Variable [ $s ; Value: MBS( "Shell.WriteInputText"; $shell; Char(10); "UTF-8") ]
End If

Run a command line tool with input:

Set Variable [ $shell ; Value: MBS( "Shell.New" ) ]
Set Variable [ $s ; Value: MBS( "Shell.Execute"; $shell; "/Applications/"; "-s_srs"; "EPSG:25832"; "-t_srs"; "EPSG:4326"; "-output_xy") ]
# send input data and close input
Set Variable [ $s ; Value: MBS( "Shell.WriteInputText"; $shell; "666862 6716190"; "UTF-8") ]
Set Variable [ $s ; Value: MBS( "Shell.CloseInput"; $shell ) ]
# wait for app to finish
Set Variable [ $s ; Value: MBS( "Shell.Wait"; $shell; 5) ]
# read results
Set Variable [ $error ; Value: MBS( "Shell.ReadErrorText"; $shell; "UTF-8") ]
Set Variable [ $result ; Value: MBS( "Shell.ReadOutputText"; $shell; "UTF-8") ]
Set Field [ Shell::Error ; MBS( "Text.ReplaceNewline"; $error; 1) ]
Set Field [ Shell::Output ; MBS( "Text.ReplaceNewline"; $result; 1) ]
Set Variable [ $r ; Value: MBS("Shell.Release"; $shell) ]

See also

Example Databases

Blog Entries

This function checks for a license.

Created 11st November 2017, last changed 30th January 2023

Shell.Wait - ShowURL

💬 Ask a question or report a problem