Huddled Masses
You can do more than breathe for free...
Browse: Home / Microsoft Command Line Standard

Microsoft Command Line Standard

By Joel 'Jaykul' Bennett on 17-May-2007

Microsoft has published a new Command Line Standard which sets out the standard for writing command line applications for Microsoft platforms … While it’s clearly based on the way they’ve written PowerShell, it is a spec that is “independent of any specific implementation of a shell, set of utilities or command creation technologies” and should be used for any command line interface apps for DOS, too (especially since doing so would enable your app to function in a PowerShell pipeline as well).

Anyway, it looks really interesting, and I can’t help but think that perhaps the Linux command-line could benefit from apps implementing this standard too ;-) . In particular, I like the TCSV format option as a way of enhancing plain old CSV data with type and structure information … and the standardized naming convention. Ultimately, these five points (from the spec) should be the standard for any command-line interface (although I know many linux die-hards will note they’ve been living without number five for many years):

  1. Consistent verb and parameter naming conventions.
  2. Consistent command syntax
  3. Common behaviors.
  4. Consistent error messages and exit codes.
  1. Schema-enhanced data streams and formatting.

However, Appendix A – Standardized Verb Sets and Verb Names got my attention in particular, because it actually obsoletes a few of the Verbs that were in this list on the PowerShell blog and which they’ve actually been using in the Community Extensions … Specifically, Write is marked as obsolete in favor of Set — and it’s pair Get, is to be used instead of the obsolete Read. In addition, there’s no mention of Out and *Where* is only mentioned as an obsolete version of Resolve (which really made me wonder about “Where-Object” but I guess that can be the exception that proves the rule?). The spec actually says that it is required to use verbs from the list of standard verbs in Appendix A., so there doesn’t seem to be an option to invent your own verbs.

If you have any comments about the spec, I guess you should put them on this post on their blog, rather than on this thread in the PSCX forum.

I’ll have to write another post on this later, after I’ve had a chance to re-read the spec and digest it a bit … so far it looks really good, but it sure would throw the monkey-wrench in my old console “Hello World” apps in C++ and Java … I wonder if someone will create a wrapper to make writing compliant command line apps easier (without resorting to writing PowerShell commandlets which are practically compliant automatically). I also wonder how long it will be until a new PowerShell release comes out that actually understands TCSV...

Similar Posts:

  • Get-Command in PowerShell 3 (NOTE: CTP2 Bug causes module loading)
  • PowerShell 3 – Finally on the DLR!
  • PowerShell Scripting Best Practices: Prefix A
  • ShowUI: the tutorial walkthrough
  • The problem with calling legacy/native apps from PowerShell

Posted in Huddled | Tagged .Net, Development, PowerShell, Scripting

« Previous Next »

Lijit Search

Tags

.Net .Net 2008 Scripting Games Automation Bugs Design Development Funny Gadgets GeoShell GUI Huddled Masses Internet licensing Microsoft Modules My Software News Personal PInvoke Pipeline Politics PoshCode PoshConsole PowerBoots PowerShell PowerShell Functions PowerTips Rants Recommender Repository Scripting ShowUI Software Solutions Textile Tips User Group UserInterface WalkThrough WebHosting Windows 7 WordPress WPF Xml

About Huddled Masses

This is web site is dedicated to the musings of Joel Bennett (aka Jaykul) about technology, software, software development, the web, and the world.

Any resemblance of the views expressed and the views of my employer, my terminal, or the view out my window are purely coincidental. The resemblance between them and my own views is non-deterministic. The question of the existence of views in the absence of anyone to hold them is left as an exercise for the reader.

P.S.: I occasionally link to things I think are great. When I do, I occasionally find a "referral code" so I can make a little cash. I promise that I don't link to anything just because of that cash (I wouldn't cross the street for the amount of cash those links bring in, never mind write a whole blog post) ... but I do not promise that things I link to will stay great as time passes, nor that you will agree with me about their greatness!

Archives

  • April 2012
  • February 2012
  • January 2012
  • October 2011
  • August 2011
  • July 2011
  • June 2011
  • March 2011
  • February 2011
  • January 2011

Copyright © 2012 Joel Bennett.

Powered by WordPress and Hybrid.