What are you trying to do? You could get the same results with just ls
/Get-ChildItem
and Split-Path
. Not sure if you need the Microsoft.PowerShell.Core\FileSystem::
part.
PS C:\Path\To\Dir> Get-ChildItem | Split-Path
Microsoft.PowerShell.Core\FileSystem::C:\Path\To\Dir
Microsoft.PowerShell.Core\FileSystem::C:\Path\To\Dir
Microsoft.PowerShell.Core\FileSystem::C:\Path\To\Dir
PS C:\Path\To\Dir> (Get-ChildItem).FullName | Split-Path
C:\Path\To\Dir
C:\Path\To\Dir
C:\Path\To\Dir
Edit
Assuming nuget list <my-package>
outputs a string array, you can use -replace
and regex ($
to match string end) to manipulate it and get an array of results.
$((nuget list <my-package>).Replace(" ",",") -replace "$",".nupkg")