Powershell: Export a custom object to a CSV file - extract a single property value with Select-Object
问题 I wrote a script that constructs a custom object and exports it to a CSV file: $reg = Get-ItemProperty HKLM:\\SOFTWARE\\McAfee\\DLP\\Agent | Select-Object agentversion $date = Get-ItemProperty \'C:\\Program Files\\McAfee\' | Select-Object {$_.LastWriteTime} $date86 = Get-ItemProperty \'C:\\Program Files (x86)\\McAfee\'| Select-Object {$_.LastWriteTime} New-Object -TypeName pscustomobject -Property @{ \"Number1\"=$reg \"Number2\"=$date86 \"Number3\"=$date } | export-csv -Path C:\\****\\desktop