I have declared a powershell variable to get the packages installed on Windows 2016 server by defining a variable and i want to pipe it to a text file.
$jvn=Get-Command java | Select-Object Version
I have tried using
$jvn=Get-Command java | Select-Object Version | Out-File -FilePath .\jvn.txt
but this prints on the screen , not in text file ,
i want the output in the text File as Java Version 8.0.202.26