Monthly Archive

Categories

Quotes in CSVs

Up to and including PowerShell v6.2.x converting or exporting data to a csv has automatically put quotes round each field. In PowerShell v7 you can control quotes in CSVs

Using

Get-Service | ConvertTo-Csv

as an example.

 

The current behaviour is to put quotes round everything

"XboxNetApiSvc","System.ServiceProcess.ServiceController[]","False","False","False","Xbox Live Networking Service","Syst
em.ServiceProcess.ServiceController[]",".","XboxNetApiSvc","System.ServiceProcess.ServiceController[]",,"Stopped","Win32
ShareProcess","Manual",,

 

This is still the default behaviour in PowerShell v7 but there’s now a –usequotes parameter to control the quotes. Its default value is always to match previous behaviour.

 

Other options are AsNeeded and Never

AsNeeded consistently threw an error but Never seems to work

Comments are closed.