Skip to content

Latest commit

 

History

History

Strict-Mode

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

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