Managing non-terminating errors

Most errors which occur in your working scripts are likely to be “non-terminating”.  This means that Monad just reports the error and the command keeps running.  (“Terminating” errors such as syntax errors will halt the command and, in some cases, the entire script; see http://blogs.msdn.com/monad/archive/2005/11/15/493102.aspx for more details.).  This Blog describes how to handle non-terminating…

0

Getting MSDN help urls for .NET BCL types and Members

 Often when playing with .Net objects in Monad, I need to use MSDN class library reference to learn how to use a particular type and its members. Now, I have my bookmarks and favorite search engine but I always thought it would be cool if get-member cmdlet could provide me a help link/reference to go to. Thanks…

6

Check Spelling Script

After reading Marcel’s introductory piece on ScriptBlock, I decided to rewrite an old script of mine that checks the spelling of all text files in a directory. Here is what I came out with. #region Parse a line to a list of words $StringFind ={param ($str, $start, $cond)  if ($start -ge 0 -and $start -lt $str.Length) {    for($i = $start;…

2

A bit about Scriptblocks

When scripting with MSH one of the most useful things to know about are scriptblocks (lambda functions).  Scriptblocks are compiled bits of MSH script which you can pass around and invoke whenever you feel like it.  They turn out to be so useful that if you look at the cmdlets you’ll find a few that…

2

Monad portal in Script Center.

Most scripters are familar with Microsoft script center.  Script center now has a portal for Microsoft Command Shell.  You can access the portal at http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx -Arul Kumaravel

1

PINVOKE or accessing WIN32 APIs

In the very early days of Monad, we focused on a world where everyone would publish Cmdlets and providers.  Cmdlets and providers were designed around providing the best user experience.  They provide the right, high-level, task-oriented abstractions that users want while also providing the semantic benefits that the Monad engine provides (-WHATIF, -CONFIRM, -VERBOSE, -ERRORACTION, -ERRORVARIABLE, etc etc). …

6

Using-Culture -Culture culture -Script {scriptblock}

One of the traditional challenges with scripting is dealing with different CULTURES.  Imagine the case where you are writing a script and you’ll have to parse datetime string from different cultures.  If it was just one culture, you could set the process culture and be done with it.  Here is a function that allows you to…

5

Debugging Monad Scripts, Part 7 (Final): How Traps Work

Did your command or script fail and/or report an error?  We hope to have a proper script debugger in a future version, but until then, MSH has some handy features to help you figure out what went wrong.  In this series of blog entries, I will present some of those features.  Thanks to Jim Truher…

2

Debugging Monad Scripts, Part 6: Trace-Expression, Breakpoint Script

Did your command or script fail and/or report an error?  We hope to have a proper script debugger in a future version, but until then, MSH has some handy features to help you figure out what went wrong.  In this series of blog entries, I will present some of those features.  Thanks to Jim Truher…

4

Debugging Monad Scripts, Part 5: Preferences and Commandline Options

Did your command or script fail and/or report an error?  We hope to have a proper script debugger in a future version, but until then, MSH has some handy features to help you figure out what went wrong.  In this series of blog entries, I will present some of those features.  Thanks to Jim Truher…

5