Using msh.exe interactively from within other programs

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.]

3 Responses to “Using msh.exe interactively from within other programs”

  1. Andy writes:

    That did the trick – I can execute commands in Emacs now. It’s definitely a bit wierd not to see any prompts, but I’ll take what I can get. Thanks for the tip! :)

  2. Faried Nawaz writes:

    Won’t this work? msh -command – < test.msh > output.txt

  3. Lee writes:

    It does work, Faried — I’m not sure what you’re responding to :)

    The limitation I wrote about deals with an interactive redirected shell (ie: in Emacs, or as an SSH endpoint.)

    Lee

Leave a Reply