Converting strings
PowerShell has a variety of commands that can be used to convert strings into objects.
Several commands are available specifically to work with strings:
- The
*-Csv
commands ConvertFrom-StringData
Convert-String
ConvertFrom-String
The Convert-String
and ConvertFrom-String
commands are part of a project called Flash Extract by Microsoft Research and have never been converted for use in .NET Core. These commands are only available in Windows operating systems and only available in PowerShell 7 via a compatibility session.
In addition to these commands, PowerShell can make use of the ToBase64String
and FromBase64String
methods of the Convert
class to work with Base64-encoded data.
The *-Csv commands
ConvertTo-Csv
turns objects in PowerShell into comma-separated value (CSV) strings:
PS> Get-Process -Id $pid | Select-Object Name, Id, Path | ConvertTo-Csv
"Name","Id","Path"
...