Summary: Easily convert a character array to a string in Windows PowerShell.
How can I use Windows PowerShell to convert data that is returning as an array of characters
instead of as a single string?
Use the unary operator, and pass the array. In the following example, the first command returns an
array of characters, and the next the unary operator converts the character array to a single string:
PS C:\> $a = (get-module -l)[0].Path | split-path -Parent
PS C:\> $a[0]
C
PS C:\> $b = (,$a)
PS C:\> $b[0]
C:\Users\ed\Documents\WindowsPowerShell\Modules\ConversionModule
PS C:\>