uniqe value

%3CLINGO-SUB%20id%3D%22lingo-sub-2068833%22%20slang%3D%22en-US%22%3Euniqe%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2068833%22%20slang%3D%22en-US%22%3E%3CP%3Ehow%20can%20i%20have%20uniqe%20return%20for%20below%20code%2C%20i%20need%20the%20true%20value%20onlye%3C%2FP%3E%3CP%3E%24Folder%20%3D%20Get-ChildItem%20-Path%20C%3A%5C10%20-Directory%20%7C%20%25%20%7B%24_.Name%20-eq%20'Test'%7D%3C%2FP%3E%3CP%3Eforeach(%24Folders%20in%20%24Folder)%3CBR%20%2F%3E%7B%3C%2FP%3E%3CP%3E%24Folders%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3Ecurrent%20result%20im%20getting%3C%2FP%3E%3CP%3EFalse%3CBR%20%2F%3ETrue%3CBR%20%2F%3EFalse%3CBR%20%2F%3EFalse%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2068833%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2068856%22%20slang%3D%22zh-CN%22%3EReply%3A%20uniqe%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2068856%22%20slang%3D%22zh-CN%22%3E%3CP%3E3788%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F932292%22%20target%3D%22_blank%22%3E%40PS1Exprt_IMHD%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2068858%22%20slang%3D%22zh-CN%22%3EReply%3A%20uniqe%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2068858%22%20slang%3D%22zh-CN%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F913992%22%20target%3D%22_blank%22%3EWhat's%20the%20s197544138%3F%3C%2FA%3E%20I%20don't%20understand%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

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

@197544138 什么啊?不懂啊

 

@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 :)