lptstr / winfetch

🛠 A command-line system information utility written in PowerShell. Like Neofetch, but for Windows.
MIT License
1.4k stars 77 forks source link

.NET Version in list #217

Open theuserbl opened 5 months ago

theuserbl commented 5 months ago

WinFetch shows the PowerShell-Version as Shell. But is it possible, to add additional the .NET Version?

.NET 5.x have the version in $PSVersionTable under CLRVersion. And .NET Core and .NET 6.x+ can adding it to $PSVersionTable, if it is not a preview version, with $PSVersionTable.CLRVersion = [System.Runtime.InteropServices.RuntimeInformation]::FrameworkDescription -split '\s' | select -Last 1

TMA-2 commented 3 weeks ago

See the wiki section on custom segments.

In the configuration file, you can add a custom function like the following (fixed up in a one-liner):

function info_dotnet_version {
    Return @{
        Title = ".NET Version"
        Content = [System.Runtime.InteropServices.RuntimeInformation]::FrameworkDescription.Split(' ')[-1]
    }
}

and then reference it in the list:

@(
    "dotnet_version"
    # more fields...
)

which should then give you:

.NET Version: 8.0.7

...Or 4.8.4744, or whatever edition/CLR you're on.