I need to get a string from powershell output. I need to get package name
i.e prompt-toolkit and use it in the pipe below
> pip list --outdated
Package Version Latest Type
-------------- ------- ------ -----
prompt-toolkit 1.0.15 2.0.3 wheel
pip list --outdated | Where-Object { $exclude -notcontains $_ } | ForEach { pip install -U $_.split(" ")[0] }
UPDATE.
The modified working script
$(
$exclude = 'virtualenv', 'prompt-toolkit'
pip list --outdated --format=freeze | ForEach{ $_.split("=")[0]} | Where-Object { $exclude -notcontains $_ } | ForEach { pip install -U $_ }
) *>&1 >> Python_Modules_Updates_Log.txt
simply try