July 2018
Beginner
552 pages
13h 18m
English
It is very important to include meaningful comments in your script. There are generally two types of comment: single line and block comments.
When commenting your code, you should always try to be concise and describe parts of your code that are not self-explanatory. In general, PowerShell cmdlets lend themselves to self-documenting code. To improve readability, always include a whitespace after a hashtag. Short comments can also be written inline, after your line of code:
# Bad# Sets value to 42$illegibleVariable = 42# Good# Initialize repetition interval for scheduled task$taskRepetitionMinutes = 42
Block comments are useful when a comment is longer, such as a header or disclaimer. They are usually used when writing comment-based ...
Read now
Unlock full access