PowerShell programming conventions
Posted
by
Tahir Hassan
on Programmers
See other posts from Programmers
or by Tahir Hassan
Published on 2012-10-31T14:23:38Z
Indexed on
2012/10/31
17:13 UTC
Read the original article
Hit count: 319
.NET
|automation
Do you follow any any conventions when programming in PowerShell?
For example, in scripts which are to be maintained long-term do you:
- Use the real cmdlet name or alias?
- Specify the cmdlet parameter name in full or only partially (
dir -Recurse
versusdir -r
) - When specifying string arguments for cmdlets do you enclose them in quotes (
New-Object 'System.Int32'
versusNew-Object System.Int32
- When writing functions and filters do you specify the types of parameters?
- Do you write cmdlets in the (official) correct case?
- For keywords like
BEGIN...PROCESS...END
do you write them in uppercase only?
Thanks for any replies.
© Programmers or respective owner