PowerShell Cookbook

Search

Categories

 

On this page

Archive

Blogroll

Disclaimer
I work for Microsoft.

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 222
This Year: 0
This Month: 0
This Week: 0
Comments: 536

Sign In

 Thursday, April 20, 2006
Thursday, April 20, 2006 6:28:57 PM (Pacific Daylight Time, UTC-07:00) ( )

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

Thursday, April 20, 2006 9:29:51 PM (Pacific Daylight Time, UTC-07:00)
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! :)
Saturday, April 22, 2006 7:34:46 PM (Pacific Daylight Time, UTC-07:00)
Won't this work? msh -command - < test.msh > output.txt
Monday, April 24, 2006 12:09:43 AM (Pacific Daylight Time, UTC-07:00)
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
Name
E-mail
Home page

Comment (Some html is allowed: b, blockquote@cite, em, i, strike, strong, sub, super, u)  

Enter the code shown (prevents robots):