uniqe value

New Contributor

how can i have uniqe return for below code, i need the true value onlye

$Folder = Get-ChildItem -Path C:\10 -Directory | % {$_.Name -eq 'Test'}

foreach($Folders in $Folder)
{

$Folders

}

current result im getting

False
True
False
False

3 Replies

@1975 什么啊?不懂啊

 

@PS1Exprt_IMHD 

Hi

you can use 

$Folders | where {$_ -like $true}

in the foreach block instead of only $Folders.

 

 

---------------

if you find this answer helpful, please click on Best response and give like :)