Using msh.exe interactively from within other programs

Thu, Apr 20, 2006 One-minute read

In a recent post, Andy describes his quest to use msh.exe as the Emacs interactive shell.  He got single commands to work, but the interactive experience does not output any prompts.  This will be the experience from any application that redirects Monad’s standard input stream.

First, the syntax to make Monad read commands from a redirected input stream is -command –.  This places Monad into batch input mode.  In the batch input mode, Monad treats standard input as though it is content in a script, allowing a scenario like:

type test.msh | msh -command - > output.txt

Batch input mode suppresses prompting so that the prompts do not interfere with the script’s output.  You will see a similar problem if you try to use Monad directly as a Telnet / SSH endpoint

We are aware of this limitation, and hope to fix the issue in V2.  As always, we invite you to provide your feedback on this decision at the Monad Microsoft Connect site.

[Edit: Monad has now been renamed to Windows PowerShell. This script or discussion may require slight adjustments before it applies directly to newer builds.]