79231455

Date: 2024-11-27 18:25:35
Score: 2.5
Natty:
Report link

Same Problem. I have a simple function in a module:
NumberOfFoldersInDir($pathToDir, $_isRecursive)

This module is used by a class within another module. I return a value, depending on the optional bool param _isRecursive: if($_isRecursive) { return (1) }; else { return (2) }

1) (Get-ChildItem -Path $pathToDir -Directory -Recurse).Count
2) (Get-ChildItem -Path $path -Directory).Count

In the module, when I save to a variable and write-host, values are:
1) == 2
2) == 1

In my class, in the other module:
1) $returnVal = NumberOfFoldersInDir $path $true == 2 Checks Out.
2) $returnValue = NumberOfFoldersInDir $path $false == 3 WTF?

Reasons:
  • RegEx Blacklisted phrase (1): Same Problem
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: The-Stanislav