Wednesday, September 11, 2013

PowerShell Techniques : Visual Formatting of the Powershell Scripts.

 

Hi,

I am finally back to India, and it is always good to be at home.

This week is a bit busy, catching up with my pending work.

Today while writing a new script I was checking few of my Old scripts. And i realised that my old scripts are bit hard to read , why? because of  improper formatting.

Formatting? why? why we need a formatting in a script? this is not a Word, PowerPoint document.

Yes, formatting is a essential and key part of the scripting, more neat and properly formatted your script is , more it is easy to read and easy to maintain.

For example.

11-09-2013 23-08-52

versus

11-09-2013 23-09-27

Now you can see that, reading script is bit easy in the second screenshot rather then the first one. This create a neat and clean type of scripts , rather then a messy one.

few tips and shortcuts.

  1. If you want to increase the indent of whole script, then just select whole script code and Press TAB.11-09-2013 23-14-44
  2. If you want to decrease the indent of whole script, select the script and press SHIFT + TAB
  3. To indent a single line, just press TAB
  4. To separate two section / function in the script, you can use a visual seprater like this, so that you know, another section is started.11-09-2013 23-20-23 

 

That’s all for now.

 


Thanks
Aman Dhally
clip_image001 clip_image002 clip_image003 clip_image005clip_image007

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.