Sunday, November 30, 2008

Powershell Advocacy for consuming .NET Programs

Powershell is more than a shell. Programs initially not written to be used using shell can also be involved into Powershell script, or cmdlets. Example is my “Get List of File Associated with multiple Changesets” which could also be written in a simple c# program, that too in more user kissing manner with GUI. But compromising on user interface brings more advantages which a developer loves to have for its program, especially for the ones used by developers. Here is why:

  1. Faster to write: A power shell script written in 4-5 line in above example may take around 20-100 lines or so to write in C# program. Once you are familiar with the syntax of cmdlet scripting, I think development is very much faster.
  2. Faster to modify: If you want to change output in any manner, it’s damn easy to understand the script and change it.
  3. Easy to Run: Once u have Powershell setup, it’s just like running ipconfig or ping!! 
  4. Easy to extend the output: Output formatting provided inside Powershell is a great deal. Also, easy to write output in files and so easy to use your favorite text editor (mine is scintilla based SciTe). 
  5. Easy to Reuse: Pipe and reuse the script which u already wrote for some purpose. Or just use script inside script.