As I mentioned in question, this seems like bug in Powershell engine.
When I try to print the files in the current directory(where the said powershell script is also present) by excluding some file-types(extensions), it doesn't print anything. For eg. below codes print contents of Current Folder in the Powershell console:
gci
gci -pa .
Both the above codes print the directory contents as below:
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 20-09-2020 22:37 835799796 file1.mkv
-a---- 20-09-2020 22:25 148 file1.srt
-a---- 23-09-2020 04:53 357 scriptv1.ps1
-a---- 20-09-2020 22:25 678 file1.txt
But when I run below code, it doesn't print anything, when it must print file1.txt:
$excluded = @('*.mkv','*.mp4','*.srt','*.sub','*.ps1')
Get-ChildItem -Exclude $excluded | Write-Host { $_.FullName }
Can anyone assist figuring out why is it happening and how to get what I mentioned ?