When using powershell, sometimes I want to display, for example, the name or full name of the file.
From what I can assemble, the way to do this is to use Get-ItemProperty(an alias gp) and pass -n fullname, for example
PS C:\Dev> gp . -n fullname
In particular, I want to use this in longer scripts in conjunction with foreach, and whereetc.
Powershell then displays the full name, but also displays a bunch of other things, as shown below:
PSPath : Microsoft.PowerShell.Core\FileSystem::C:\Dev
PSParentPath : Microsoft.PowerShell.Core\FileSystem::C:\
PSChildName : Dev
PSDrive : C
PSProvider : Microsoft.PowerShell.Core\FileSystem
fullname : C:\Dev
My question is: how can I get powershell to display only the property that I want (full name) and not rotate the display with all other things. Is the Get-ItemPropertyright way?
Update:
If I do this:
ls -r | ?{ $_.fullname -match "foo" }
, , "foo" . Mode, LastWriteTime, Length . Get-ItemProperty , ?