Skip to content

Fast way to obtain the version of current WSL instance #11475

@CarterLi

Description

@CarterLi

Is your feature request related to a problem? Please describe.

I want to find a fast way to detect the current version of WSL for my project fastfetch.

Describe the solution you'd like

I suggest that wslinfo should introduce a new flag called --wsl-version to print the version of current WSL instance

$ wslinfo --wsl-version
2.2.2.0

Alternately, provide /mnt/wsl/versions.txt which contains the output of wsl.exe --version. We already have /mnt/wslg/versions.txt. WSL can have the same.

Alternately, provide an environment variable called WSL_VERSION

Describe alternatives you've considered

Currently I am using wsl.exe --version. This command costs about 100ms while the whole program costs only 200ms.

Additional context

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions