Is there a way to append content to a variable in the same way that you can when outputting to a file?
$Process = get-process
foreach ( $thing in $Process )
$Path = $thing.path | out-file c:\PathList.txt -append
$ProcessPath = Get-Content -Path C:\PathList.txt
Is there a way to keep adding content to a variable while the foreach loop is running? The aim would be to have a variable containing data that could then be used for other purposes. It works by outputting to a text file but seems a bit messy.