I need help removing the @{} extensions from object output.
The code bellow is listing the last modified file inside a folder. But the output is inside extension @{}.
I have tried the Out-String but it is not working.
function scriptA() {
Get-ChildItem $path | Where-Object {!$_.PsIsContainer} | Select fullname -last 1
}
function scriptB() {
Get-ChildItem $path2 | Where-Object {!$_.PsIsContainer} | Select fullname -last 1
}
$data1=ScritA
$data2=ScriptB
$result=@()
$list=@{
FirstFile=$data1
SecondFile=$data2
}
$result+= New-Object psobject -Property $list
$result | Export-Csv -append -Path $csv
This will output: FirstFile @{data1} and SecondFile @{data2}
Select fullname->Select -Expand fullname