Skip to content

Add query for OS revision number to windows-version crate#3752

Merged
kennykerr merged 1 commit into
masterfrom
version-revision
Sep 9, 2025
Merged

Add query for OS revision number to windows-version crate#3752
kennykerr merged 1 commit into
masterfrom
version-revision

Conversation

@kennykerr

Copy link
Copy Markdown
Collaborator

The windows-version crate provides reliable operating system version information without the need for application manifest files. The OsVersion struct provides the traditional OS version information for major, minor, service pack, and build number. Unfortunately, recent Windows versioning conventions have largely dropped the use of minor and service pack versions while adding a new revision number as you can see when you run commands like winver.exe or cmd.exe.

This update adds a revision function to the windows-version crate that lets you reliably get the same version information used by these OS tools. Here's a simple example that mimics what cmd.exe displays:

fn main() {
    let current = windows_version::OsVersion::current();

    let major = current.major;
    let minor = current.minor;
    let build = current.build;
    let revision = windows_version::revision();

    println!("Microsoft Windows [Version {major}.{minor}.{build}.{revision}]");
}

@kennykerr
kennykerr merged commit 2b37e78 into master Sep 9, 2025
28 checks passed
@kennykerr
kennykerr deleted the version-revision branch September 9, 2025 19:00
This was referenced Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants