Added 'Set-ScrictMode'

This commit is contained in:
Markus Fleschutz 2020-12-27 10:15:03 +00:00
parent a7bbbb99a7
commit d088342086
3 changed files with 6 additions and 1 deletions

View File

@ -135,7 +135,8 @@ Each PowerShell script should follow the 7 golden rules:
* **Rule #4:** provide a metadata header with syntax, description, author, source, and license
* **Rule #5:** prefer command-line options, else ask the user
* **Rule #6:** the encoding of the script is in UTF-8 with BOM to support Unicode characters
* **Rule #7:** exits 0 for success, else print an error message and exit with the error code (mostly 1)
* **Rule #7:** use 'Set-StrictMode -Version Latest' to enable additional error checking
* **Rule #8:** exits 0 for success, else print an error message and exit with the error code (mostly 1)
Feedback
--------

View File

@ -6,6 +6,8 @@
# Source: github.com/fleschutz/PowerShell
# License: CC0
Set-StrictMode -Version Latest
try {
$StartTime = Get-Date

View File

@ -8,6 +8,8 @@
param([String]$Text)
Set-StrictMode -Version Latest
function BigA() { param([Int]$Row)
switch($Row) {
1 { return " __ " }