How to get folder name using get-childitem


i want display folder name , using following code

$homefolders = get-childitem -literalpath $folder123 -force -erroraction silentlycontinue| select fullname, name, psiscontainer, length, extension
foreach($folder in $homefolders){
 write-host $folder.fullname
 write-host "$folder.name
}

it display actual folder name, displaying as
\\server\user1\home\test1
@{fullname=\\server\user1\home\test1; name=test1; psiscontainer=true; length=; extension=}.name folder

i want folder name should display test1.

pls let me know missing here

albert


$(folder.fullname | split-path -leaf)


Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Edit Group Policy

Hyper-V VM not reaching OS 'Logon' screen

DNS question...