Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 1.17 KB

File metadata and controls

31 lines (21 loc) · 1.17 KB

Count and Length of a scalar fail in the strict mode

See help about_Properties:

Beginning in Windows PowerShell 3.0, Windows PowerShell tries
to prevent scripting errors that result from the differing
properties of scalar objects and collections.

--  If you request the Count or Length property of zero objects
    or of one object, Windows PowerShell returns the correct value.

The problem is that these properties Count and Length of a scalar fail in the strict mode.

Obviously these properties should not be used in scripts designed to work in the strict mode. Public scripts should avoid these properties because this mode can be enabled by a caller.

Scripts