mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-31 09:59:17 +01:00
Merge branch 'master' of github.com:fleschutz/PowerShell
This commit is contained in:
commit
863e55138c
@ -93,11 +93,11 @@ Which editor to use for PowerShell scripts?
|
|||||||
|
|
||||||
How to write good PowerShell scripts?
|
How to write good PowerShell scripts?
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
Good PowerShell scripts are user-friendly and platform-independent. As a guideline follow these rules, please:
|
Good PowerShell scripts are user-friendly and platform-independent. The following rules should be a good starting point:
|
||||||
|
|
||||||
1. Use the `<verb>-<object>.ps1` scheme to name the script.
|
1. Use the `<verb>-<object>.ps1` scheme to name the script.
|
||||||
2. Use *UTF-8 BOM* encoding to support Unicode characters in the script.
|
2. Use `UTF-8 BOM` encoding to support Unicode characters in the script.
|
||||||
3. Add a comment-based help at the beginning with synopsis, description, parameters, link, author, and license.
|
3. Add a comment-based help at the beginning with: `.SYNOPSIS`, `.DESCRIPTION`, `.PARAMETER`, `.EXAMPLE`, `.LINK`, and `.NOTES`.
|
||||||
4. Check the requirements for the script, e.g. `#Requires -RunAsAdministrator`, or `#Requires -Version 3`
|
4. Check the requirements for the script, e.g. `#Requires -RunAsAdministrator`, or `#Requires -Version 3`
|
||||||
5. Prefer command-line options, else ask the user for help
|
5. Prefer command-line options, else ask the user for help
|
||||||
6. Recommended is `Set-StrictMode -Version Latest` to enable additional error checking.
|
6. Recommended is `Set-StrictMode -Version Latest` to enable additional error checking.
|
||||||
|
Loading…
Reference in New Issue
Block a user