Sign in to follow this  
Followers 0
Brenton

A more up to date @OSVersion

5 posts in this topic

I tried to post this to example scripts but I don't seem to have permission...

Anyway, for those of you using Windows 7, you probably already figured out that @OSVersion returns "WIN_VISTA" for both Vista and Win7. I wrote a quick function that returns the correct value. Enjoy!

Func OSVersion()
    If @OSVersion = "WIN_VISTA" Then
        $version = FileGetVersion(@SystemDir & "\WinVer.exe");
        If StringLeft($version,3) = "6.0" Then
            Return "WIN_VISTA"
        Else 
            Return "WIN_7"
        EndIf
    Else
        Return @OSVersion
    EndIf
EndFunc

Share this post


Link to post
Share on other sites



You don't have permission becouse you don't have 5 posts, get a mod to move it...

that looks quite handy, Not that i'd have any use for it, winxp all the way! ^_^

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

The problem is that Microsoft decided to give Windows 7 a version number of 6.1.xxxx

(You would think that Windows "7" would have a version number of "7"...)

I don't know why they did that but that's the reason I put 6.0 for Vista.

Looking at Version-Info of my XP (5.1.26...) this might be more accurate in the long run ^_^...

StringLeft($version,2) = "6."

Share this post


Link to post
Share on other sites

The problem is that Microsoft decided to give Windows 7 a version number of 6.1.xxxx

(You would think that Windows "7" would have a version number of "7"...)

I don't know why they did that but that's the reason I put 6.0 for Vista.

They gave it a version of 6.1 because it is built on the same basic kernal as vista (6.0) they made changes to it, but it is not a rewrite, hence 6.1 and not 7.

7 will be the next major rewrite of the kernal.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0